media: davinci: vpif_capture: fix potential NULL deref
authorKevin Hilman <khilman@baylibre.com>
Tue, 11 Jul 2017 19:07:52 +0000 (15:07 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 19 Jul 2017 19:13:04 +0000 (15:13 -0400)
Fix potential NULL pointer dereference in the error path of memory
allocation failure.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/davinci/vpif_capture.c

index 70ffba70164fbed5cfa7ce80f4f2cf8944b9ffb8..fe2a5748e554fb129bf887ac205c5082e96b9393 100644 (file)
@@ -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;
 }