From: Gustavo A. R. Silva Date: Thu, 23 Nov 2017 03:34:44 +0000 (-0500) Subject: media: davinci: vpif_capture: add NULL check on devm_kzalloc return value X-Git-Tag: v5.15~9456^2~367 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f;p=mirror_ubuntu-kernels.git media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Check return value from call to devm_kzalloc() in order to prevent a NULL pointer dereference. This issue was detected with the help of Coccinelle. Fixes: 4a5f8ae50b66 ("[media] davinci: vpif_capture: get subdevs from DT when available") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index fca4dc829f73..e45916f69def 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1550,6 +1550,8 @@ vpif_capture_get_pdata(struct platform_device *pdev) sizeof(*chan->inputs) * VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); + if (!chan->inputs) + return NULL; chan->input_count++; chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;