public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Irui Wang <irui.wang@mediatek.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: <Project_Global_Chrome_Upstream_Group@mediatek.com>,
	<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<maoguang.meng@mediatek.com>,
	Yunfei Dong <yunfei.dong@mediatek.com>,
	"Irui Wang" <irui.wang@mediatek.com>
Subject: [PATCH v2, 2/2] media: mediatek: vcodec: make sure pointer isn't NULL before used
Date: Tue, 11 Apr 2023 13:54:13 +0800	[thread overview]
Message-ID: <20230411055413.539-3-irui.wang@mediatek.com> (raw)
In-Reply-To: <20230411055413.539-1-irui.wang@mediatek.com>

CERT-C Expression check:
Dereferencing buf, which is known to be NULL, check buf is not NULL
before used.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
index d65800a3b89d..db65e77bd373 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c
@@ -943,7 +943,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
 		 * FIXME: This check is not needed as only active buffers
 		 * can be marked as done.
 		 */
-		if (buf->state == VB2_BUF_STATE_ACTIVE) {
+		if (buf && buf->state == VB2_BUF_STATE_ACTIVE) {
 			mtk_v4l2_debug(0, "[%d] id=%d, type=%d, %d -> VB2_BUF_STATE_QUEUED",
 					ctx->id, i, q->type,
 					(int)buf->state);
-- 
2.18.0


  parent reply	other threads:[~2023-04-11  5:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11  5:54 [PATCH v2, 0/2] fix coverity issues in encoder driver Irui Wang
2023-04-11  5:54 ` [PATCH v2, 1/2] media: mediatek: vcodec: make sure array index is in valid range Irui Wang
2023-04-11  8:22   ` Alexandre Mergnat
2023-04-11  5:54 ` Irui Wang [this message]
2023-04-11  7:22   ` [PATCH v2, 2/2] media: mediatek: vcodec: make sure pointer isn't NULL before used Yunfei Dong (董云飞)
2023-04-11  7:38     ` Irui Wang (王瑞)
2023-04-11  6:25 ` [PATCH v2, 0/2] fix coverity issues in encoder driver Yunfei Dong (董云飞)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230411055413.539-3-irui.wang@mediatek.com \
    --to=irui.wang@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maoguang.meng@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=yunfei.dong@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox