From 5a634ae0b158f845fe7f9603ae843f429b8a4c85 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Tue, 11 Jul 2017 15:07:52 -0400 Subject: [PATCH] media: davinci: vpif_capture: fix potential NULL deref Fix potential NULL pointer dereference in the error path of memory allocation failure. Reported-by: Dan Carpenter Signed-off-by: Kevin Hilman Acked-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/davinci/vpif_capture.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 70ffba70164f..fe2a5748e554 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1593,9 +1593,11 @@ vpif_capture_get_pdata(struct platform_device *pdev) } done: - pdata->asd_sizes[0] = i; - pdata->subdev_count = i; - pdata->card_name = "DA850/OMAP-L138 Video Capture"; + if (pdata) { + pdata->asd_sizes[0] = i; + pdata->subdev_count = i; + pdata->card_name = "DA850/OMAP-L138 Video Capture"; + } return pdata; } -- 2.39.5