summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-07-09 15:30:25 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-08-04 15:43:52 +0300
commit09ea9719a423fc675d40dd05407165e161ea0c48 (patch)
treeeeadb2bb5569d74ffe0ce28ee04ebcff5bf9a17a /drivers/media
parent331e06bbde5856059b7a6bb183f12878ed4decb1 (diff)
downloadlinux-09ea9719a423fc675d40dd05407165e161ea0c48.tar.xz
media: venus: venc: Fix potential null pointer dereference on pointer fmt
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>
Diffstat (limited to 'drivers/media')
-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 8dd49d4f124c..1d62e38065d6 100644
--- a/drivers/media/platform/qcom/venus/venc.c
+++ b/drivers/media/platform/qcom/venus/venc.c
@@ -183,6 +183,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),