[media] davinci: vpif_capture: fix potential NULL deref
Commit Message
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>
---
drivers/media/platform/davinci/vpif_capture.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Comments
On Tue, Jul 11, 2017 at 12:07:52PM -0700, Kevin Hilman wrote:
> 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>
@@ -1593,10 +1593,12 @@ 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;
}