Skip to content

Commit 09ea971

Browse files
Colin Ian Kingmchehab
authored andcommitted
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: aaaa93e ("[media] media: venus: venc: add video encoder files") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 331e06b commit 09ea971

File tree

1 file changed

+2
-0
lines changed
  • drivers/media/platform/qcom/venus

1 file changed

+2
-0
lines changed

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)