Commit 11e0e167 authored by Colin Ian King's avatar Colin Ian King Committed by Mauro Carvalho Chehab

media: meson: add missing allocation failure check on new_buf

Currently if the allocation of new_buf fails then a null pointer
dereference occurs when assiging new_buf->vb. Avoid this by returning
early on a memory allocation failure as there is not much more can
be done at this point.

Addresses-Coverity: ("Dereference null return")

Fixes: 3e7f51bd ("media: meson: add v4l2 m2m video decoder driver")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 55f240a2
...@@ -133,6 +133,8 @@ vdec_queue_recycle(struct amvdec_session *sess, struct vb2_buffer *vb) ...@@ -133,6 +133,8 @@ vdec_queue_recycle(struct amvdec_session *sess, struct vb2_buffer *vb)
struct amvdec_buffer *new_buf; struct amvdec_buffer *new_buf;
new_buf = kmalloc(sizeof(*new_buf), GFP_KERNEL); new_buf = kmalloc(sizeof(*new_buf), GFP_KERNEL);
if (!new_buf)
return;
new_buf->vb = vb; new_buf->vb = vb;
mutex_lock(&sess->bufs_recycle_lock); mutex_lock(&sess->bufs_recycle_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment