4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Gustavo A. R. Silva" <[email protected]>


[ Upstream commit 5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f ]

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 <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/media/platform/davinci/vpif_capture.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1545,6 +1545,8 @@ vpif_capture_get_pdata(struct platform_d
                                            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;


Reply via email to