summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-11-22 22:34:44 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-08 11:15:41 -0500
commit5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f (patch)
tree1421b4340a43bf03257ab5ebc43fcb605d7bb2bb /drivers/media/platform
parent20772c1a6f0e03d4231e2b539863987fa0c94e89 (diff)
downloadlinux-5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f.tar.gz
linux-5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f.tar.bz2
linux-5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f.zip
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 <garsilva@embeddedor.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/davinci/vpif_capture.c2
1 files changed, 2 insertions, 0 deletions
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;