From patchwork Wed Nov 2 12:10:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 13028074 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9AFB4C433FE for ; Wed, 2 Nov 2022 12:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cLo6VBFJCNQR+eYXnnnjB2tcX7pRhD4yaIlT+Y7Cy1o=; b=HlwVS8kSC7iGo/ L2jkjde121VAsik1aNbeKqcAcTtv6W9Vs03N7krufVsUHL3y+N0K2I5Bu6CyhSDdW0NHYmKgHT+13 zdeugI1l3zskMQqcm67leFuAGa7TnRfjHMcjH2EJRpxYAXCZWKgYuTxOhdE4HYPrrWk0veKWwdFs2 t/Y4lk27K2vcdQOEXS6tH1bcG70Xar4l2XNuirtzVPMahg476wlx8JA9yUA9wm74P5ct1ZWZgPauu w0/DDShajVt5lrUAq577IQU04BoOD5/KOgQK7Inu6xLbr60x92gluOkt/Anm4K50qgl+g/AzwhFj+ YeIrxEn4p0z11JUwXcZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqCaA-00Av7L-8f; Wed, 02 Nov 2022 12:10:58 +0000 Received: from mail.astralinux.ru ([217.74.38.119]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqCa5-00Av3Z-UQ; Wed, 02 Nov 2022 12:10:55 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 240631864286; Wed, 2 Nov 2022 15:10:37 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id x3qXL0O3_M-d; Wed, 2 Nov 2022 15:10:36 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id C9B7A1864285; Wed, 2 Nov 2022 15:10:36 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OhcNLsfn8h1N; Wed, 2 Nov 2022 15:10:36 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.20]) by mail.astralinux.ru (Postfix) with ESMTPSA id 1483F1864280; Wed, 2 Nov 2022 15:10:36 +0300 (MSK) From: Anastasia Belova To: Mauro Carvalho Chehab , Matthias Brugger Cc: Anastasia Belova , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , AngeloGioacchino Del Regno , Hans Verkuil , Nicolas Dufresne , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, lvc-project@linuxtesting.org Subject: [PATCH v2] vcodec: mediatek: add check for NULL for Date: Wed, 2 Nov 2022 15:10:27 +0300 Message-Id: <20221102121027.4285-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_051054_187747_3E857FBA X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Any time calling vp9_is_sf_ref_fb we need fb != NULL after checks. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: f77e89854b3e ("[media] vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver") Signed-off-by: Anastasia Belova Reviewed-by: Nicolas Dufresne --- drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c index 70b8383f7c8e..776468cd834a 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c @@ -208,6 +208,9 @@ static bool vp9_is_sf_ref_fb(struct vdec_vp9_inst *inst, struct vdec_fb *fb) int i; struct vdec_vp9_vsi *vsi = inst->vsi; + if (!fb) + return true; + for (i = 0; i < ARRAY_SIZE(vsi->sf_ref_fb); i++) { if (fb == &vsi->sf_ref_fb[i].fb) return true;