[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190727091547.11674-1-baijiaju1990@gmail.com>
Date: Sat, 27 Jul 2019 17:15:47 +0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: stanimir.varbanov@...aro.org, agross@...nel.org, mchehab@...nel.org
Cc: linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] media: qcom: venus: Fix a possible null-pointer dereference in vdec_g_fmt()
In vdec_g_fmt(), fmt is firstly assigned NULL, and it could be never
assigned before being used on line 223:
pixmp->pixelformat = fmt->pixfmt;
Thus, a possible null-pointer dereference may occur.
To fix this bug, fmt is checked before being used here.
This bug is found by a static analysis tool STCheck written by us.
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
drivers/media/platform/qcom/venus/vdec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index e1f998656c07..12c31551f191 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -211,7 +211,8 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f)
inst->height = format.fmt.pix_mp.height;
}
- pixmp->pixelformat = fmt->pixfmt;
+ if (fmt)
+ pixmp->pixelformat = fmt->pixfmt;
if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
pixmp->width = inst->width;
--
2.17.0
Powered by blists - more mailing lists