summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-07-09 14:30:25 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-09-22 11:47:52 +0200
commita17484f832798cae4fa0beb105b70a2606c51f0d (patch)
tree49c607095b7f94c611a29eea3e8f01141be03e66 /drivers
parentfba6d1d3645cf45f17c60faeb419dd3cc3fdd6e8 (diff)
downloadlinux-stable-a17484f832798cae4fa0beb105b70a2606c51f0d.tar.gz
linux-stable-a17484f832798cae4fa0beb105b70a2606c51f0d.tar.bz2
linux-stable-a17484f832798cae4fa0beb105b70a2606c51f0d.zip
media: venus: venc: Fix potential null pointer dereference on pointer fmt
[ Upstream commit 09ea9719a423fc675d40dd05407165e161ea0c48 ] Currently the call to find_format can potentially return a NULL to fmt and the nullpointer is later dereferenced on the assignment of pixmp->num_planes = fmt->num_planes. Fix this by adding a NULL pointer check and returning NULL for the failure case. Addresses-Coverity: ("Dereference null return") Fixes: aaaa93eda64b ("[media] media: venus: venc: add video encoder files") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/platform/qcom/venus/venc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c
index 420897241248..4197b311cff4 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -316,6 +316,8 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
else
return NULL;
fmt = find_format(inst, pixmp->pixelformat, f->type);
+ if (!fmt)
+ return NULL;
}
pixmp->width = clamp(pixmp->width, frame_width_min(inst),