Skip to content

Commit eda4ccc

Browse files
Colin Ian Kinggregkh
authored andcommitted
media: venus: venc: Fix potential null pointer dereference on pointer fmt
[ Upstream commit 09ea971 ] 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: aaaa93e ("[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>
1 parent 519ad41 commit eda4ccc

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • drivers/media/platform/qcom/venus

‎drivers/media/platform/qcom/venus/venc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f)
183183
else
184184
return NULL;
185185
fmt = find_format(inst, pixmp->pixelformat, f->type);
186+
if (!fmt)
187+
return NULL;
186188
}
187189

188190
pixmp->width = clamp(pixmp->width, frame_width_min(inst),

0 commit comments

Comments
 (0)