linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] media: pxa_camera: don't deferenciate a NULL pointer
@ 2018-12-07 13:07 Mauro Carvalho Chehab
  2018-12-07 13:07 ` [PATCH 2/2] media: drxk_hard: check if parameter is not NULL Mauro Carvalho Chehab
  2018-12-07 21:11 ` [PATCH 1/2] media: pxa_camera: don't deferenciate a NULL pointer Sakari Ailus
  0 siblings, 2 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2018-12-07 13:07 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus, Akinobu Mita,
	Masami Hiramatsu, Steve Longerbeam, Nathan Chancellor,
	Robert Jarzmik

As warned by smatch:
	drivers/media/platform/pxa_camera.c:2400 pxa_camera_probe() error: we previously assumed 'pcdev->pdata' could be null (see line 2397)

It would be possible that neither DT nor platform data would be
provided. This is a Kernel bug, so warn about that and bail.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
---
 drivers/media/platform/pxa_camera.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
index 5f930560eb30..f91f8fd424c4 100644
--- a/drivers/media/platform/pxa_camera.c
+++ b/drivers/media/platform/pxa_camera.c
@@ -2396,6 +2396,9 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	pcdev->pdata = pdev->dev.platform_data;
 	if (pdev->dev.of_node && !pcdev->pdata) {
 		err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev, &pcdev->asd);
+	} else if (!pcdev->pdata) {
+		WARN_ON(1);
+		return -ENODEV;
 	} else {
 		pcdev->platform_flags = pcdev->pdata->flags;
 		pcdev->mclk = pcdev->pdata->mclk_10khz * 10000;
-- 
2.19.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-07 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-07 13:07 [PATCH 1/2] media: pxa_camera: don't deferenciate a NULL pointer Mauro Carvalho Chehab
2018-12-07 13:07 ` [PATCH 2/2] media: drxk_hard: check if parameter is not NULL Mauro Carvalho Chehab
2018-12-07 19:10   ` Nick Desaulniers
2018-12-07 21:11 ` [PATCH 1/2] media: pxa_camera: don't deferenciate a NULL pointer Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).