From patchwork Thu Sep 14 13:32:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp521013vqi; Thu, 14 Sep 2023 10:52:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEv/PN5rQajDLomOj59vrtHLzS6YtVlmpjYHt3zW+AETC9fRmbGgWapu+cUWnlefgYhofkV X-Received: by 2002:a17:902:968f:b0:1bb:c64f:9a5e with SMTP id n15-20020a170902968f00b001bbc64f9a5emr5932094plp.5.1694713936829; Thu, 14 Sep 2023 10:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694713936; cv=none; d=google.com; s=arc-20160816; b=TJUpDoP2hDyTeHRDLxrTVFQc4fX1L+OYzwdDeD15HH2GvfsNfPNYWCRwlkYQ0tkLzs K/Vffir+EI8LMzmE6M+aQsDJDzH/1sXCYXhdwoCnoH3WjqdcW5FGii9BWGV5/y/ALc00 2EFsYc/wzMHgAcMyIumCWmlOo9eIqxRZgROIVWIw6NTt/BE9sdi2aOTNDmqMBwMuT5Kq 7xy1iZiqdmUIg0p57egWFeavpwym1rX4xwCZv9ezn4BuX3dUv/HzLi4UESKjFesr3jPL P3rCCyVy25LSYlffUZM94xM2SVsvBxaj5xgVyvbTDfE+05olZcy8tdqBwK0yc/Fdz5GS LfPg== 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=etuGB0ig+YfwOMH5DMoCx2e3o/bVGJDuPKqvOV4n+KA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=bZhRiogShNZbPgSpd3IL1AOK+/BU1jnKZLhOPGeawHHNroNBWVwWdoBI9A5QgxqmYj ol07cK+7bk3p7E35cq73/g3gwv2dbXvz9KHr6o+PlRsCU2sbNx9cZYBljVIgEMomVJvg ur19K7CoUY98zrxkpvixukGEnK6ARvIe2h7w+XgUJ91rI8yA2UFbZnXOaS/uXqfEK2OY hOJw8l04aKoKbETVF/w3ZDSoKoM50KtJ3W+v6Wx1b47r29GLTh0usPPlyzmeZUREhPpk fAvb5TYmpfngp32tOYAg7k3L7XswGvNtUVAZC1wydDTAIy/wZLB5hV5eJIe6Lfrzx8Ul os/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="IhAr/pB+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id kf16-20020a17090305d000b001bf4ea978c8si1891704plb.324.2023.09.14.10.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="IhAr/pB+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id EC1C18241E3B; Thu, 14 Sep 2023 06:34:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239289AbjINNeA (ORCPT + 35 others); Thu, 14 Sep 2023 09:34:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239071AbjINNdl (ORCPT ); Thu, 14 Sep 2023 09:33:41 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 585C51FD8; Thu, 14 Sep 2023 06:33:37 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36f2:37bd:ccbb:373f]) (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 D70C6660735D; Thu, 14 Sep 2023 14:33:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698416; bh=X/zFB6sk39TwCWXEBFU3kr1spD6NOhpHJy3eiUrcvDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IhAr/pB+7jbK98HaC+CDXBPJxwbrA0EolyLkR2rr5/dJT27A0JoXzfwYFPiOShKHt 8HCev71j27Y1iYDhKVPj+CQloPTiEuUjz1v4iwwqXUwdngyRpcuZMBOk/nLqQLOb9N fVLnOf+Yx+D2DhJWroHcWEz8HDJbiMyjaIf0/sLaQB8liN4SPnoIdRF65dP/8Gupfv oXsJyZgLktFfPZZ/eNruXdL8vOSjLdS1XhnShSbcLfqv1Boli2/LvJ4MQTbqGDD0XS ebcWjbkSBmXSy/HXcwWu8If/ImAn9g1XyyhIkfwyUTFv6dPP896hNr+fKpjoVFsFeo r04qqUCp/56Mw== From: Benjamin Gaignard 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 Subject: [PATCH v7 09/49] media: atomisp: Use vb2_get_buffer() instead of directly access to buffers array Date: Thu, 14 Sep 2023 15:32:43 +0200 Message-Id: <20230914133323.198857-10-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914133323.198857-1-benjamin.gaignard@collabora.com> References: <20230914133323.198857-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:34:38 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777036360742984580 X-GMAIL-MSGID: 1777036360742984580 Use vb2_get_buffer() instead of directly access to vb2_buffer buffer array. This could allow to change the type bufs[] field of vb2_buffer structure if needed. After each call to vb2_get_buffer() we need to be sure that we get a valid pointer so check the return value of all of them. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c index d2174156573a..4b65c69fa60d 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c @@ -1061,7 +1061,7 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer if (ret) return ret; - vb = pipe->vb_queue.bufs[buf->index]; + vb = vb2_get_buffer(&pipe->vb_queue, buf->index); frame = vb_to_frame(vb); buf->reserved = asd->frame_status[buf->index];