Message ID | 20231019125222.21370-7-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp358829vqb; Thu, 19 Oct 2023 05:53:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJZJgrzK/GotULtgredPmTklD/0L4WKbigicbQiwVEWnB6/CcNq7rXLtQ0BiA9UxM0GUiO X-Received: by 2002:a05:6a21:47c6:b0:15e:b8a1:57b9 with SMTP id as6-20020a056a2147c600b0015eb8a157b9mr1768233pzc.24.1697719981852; Thu, 19 Oct 2023 05:53:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697719981; cv=none; d=google.com; s=arc-20160816; b=cYOnSPmdxVAQMdgRIcouo6DcQPJ/HkKJM51qIcHphR/0A05ZR20vF1hdj6sY+JnMSc CgSzULaukFX5eC/ncCnlnK4Ia7LG3vTNm8dCz3BMMmDQqCrX7EuCupvOrXosiDysWsEN QV96EVK6U3sP9UIHrXakafWvCZs9wKE/eRongNt/sITSjzCsBp9ZdripSVAHu1inqdBw P4yNYmwLFzjkRSrSeEtey44rDi554avXApuS1iU0p5GKddHNv4kDMiQ4RqJBSTVM5QDB 7Sk24G2QFrIS7dKPlUpRapCmNW+fUv+GiPvLU+spkt7cQjatUqs4A/ucVdnX2h7czgAc SNdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y6AR+miMPP121mWIcGoHC27lbGw2XaVJcw9mhisXWqg=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=NiQ0+09tkSrAN9d1E6NGOfKB+LULj+cDDn8/WVfXHC3aul0VhzanM+dFvnErJ4C3H2 cLTXH/mrk0OHMS1OW9fxLKt+NBJfBMyNRASmobRmI/bR2BLr0mxGwSHva+rOktczlLhZ 8W8/uhTonZjZESyJ1vzDFfj5cY6JO3uEDRIKYdlg26Iwo7KPhVs48IeZIvP5ehx1iifL XLP9gz7/dMAfeKCRklq5TJrJ1TgAsw+I6sS4uCtWWkOdqmgtDC1EplA1uxAugHJW8sEw eZKcvEZCm0EMt0D5/3KgGAxmjKo13J2auyPMbvzGkR0FaL+S+cml4GdfrXiitQU/Urmg Spew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UAgRcnQ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c27-20020a631c1b000000b0058555ea0a21si4407627pgc.571.2023.10.19.05.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:53:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=UAgRcnQ8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4876D822CFA7; Thu, 19 Oct 2023 05:52:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345787AbjJSMwp (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345374AbjJSMwg (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:52:36 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327A8119; Thu, 19 Oct 2023 05:52:35 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id A7ED8660733B; Thu, 19 Oct 2023 13:52:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719954; bh=u0/tUxGMIK/59pYU6cqm9FB8VhmlcNZDctLEaz6jcAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UAgRcnQ8C3IP76jLgwmGlm4Nrrh9/Xtp3WDe6OOVohY3419w5F4ZVy4bmzkI7xCx7 b6wtFrVpb00XxyHK9nHNvsJG6SughwbpeKq1NvQrbHKU/JG+qcBbnUP6zcsA+6AkQu ktbcjl1o9mvYxUgw1kagqP9pTiMnhYF0/gJ0NuehHywsdrYWJlQuoOfyVl25xDkGrP gm2itye59nyHHHfYuaZP17ttiHx1Ovz3S2LZ3dzOsivJj5DncXt43Xk4Ij4uOgaMi3 zslTKMAvNb9Z5evHrv78GiVOCpdCr0+UWqQCOfJHXXmJdJqX/fA0rOZe6HXV0AG8xC EBRKAmzZpuskg== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard <benjamin.gaignard@collabora.com> Subject: [PATCH v13 06/56] media: videobuf2: Remove duplicated index vs q->num_buffers check Date: Thu, 19 Oct 2023 14:51:32 +0200 Message-Id: <20231019125222.21370-7-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:52:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188427557894552 X-GMAIL-MSGID: 1780188427557894552 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:51 p.m. UTC
vb2_get_buffer() already checks if the requested index is valid.
Stop duplicating this kind of check everywhere.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/media/common/videobuf2/videobuf2-v4l2.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c index 2ffb097bf00a..c6ebc8d2c537 100644 --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c @@ -823,10 +823,6 @@ int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev, return -EBUSY; } - if (b->index >= q->num_buffers) { - dprintk(q, 1, "buffer index out of range\n"); - return -EINVAL; - } vb = vb2_get_buffer(q, b->index); if (!vb) { dprintk(q, 1, "can't find the requested buffer %u\n", b->index); @@ -898,10 +894,6 @@ int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb) { struct vb2_buffer *vb; - if (eb->index >= q->num_buffers) { - dprintk(q, 1, "buffer index out of range\n"); - return -EINVAL; - } vb = vb2_get_buffer(q, eb->index); if (!vb) { dprintk(q, 1, "can't find the requested buffer %u\n", eb->index);