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: 13028070 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC62C433FE for ; Wed, 2 Nov 2022 12:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbiKBMKu (ORCPT ); Wed, 2 Nov 2022 08:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbiKBMKq (ORCPT ); Wed, 2 Nov 2022 08:10:46 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D00523151; Wed, 2 Nov 2022 05:10:40 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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;