mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe
@ 2020-11-13 16:06 Baskov Evgeiny
  2020-11-13 16:59 ` Andrzej Pietrasiewicz
  2020-11-13 21:35 ` Jacek Anaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Baskov Evgeiny @ 2020-11-13 16:06 UTC (permalink / raw)
  To: Andrzej Pietrasiewicz
  Cc: Baskov Evgeiny, Jacek Anaszewski, Sylwester Nawrocki,
	Mauro Carvalho Chehab, linux-arm-kernel, linux-media,
	linux-kernel, ldv-project

If an error happens in jpeg_get_drv_data(), i.e. match fails,
jpeg->variant field is NULL, so we cannot access it.

Consider device probe failed if jpeg->variant is NULL.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Baskov Evgeiny <baskov@ispras.ru>
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 9b22dd8e34f4..026111505f5a 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -2862,6 +2862,8 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	jpeg->variant = jpeg_get_drv_data(&pdev->dev);
+	if (!jpeg->variant)
+		return -ENODEV;
 
 	mutex_init(&jpeg->lock);
 	spin_lock_init(&jpeg->slock);
-- 
2.29.2


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

end of thread, other threads:[~2020-11-14  7:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 16:06 [PATCH] s5p-jpeg: hangle error condition in s5p_jpeg_probe Baskov Evgeiny
2020-11-13 16:59 ` Andrzej Pietrasiewicz
2020-11-13 21:35 ` Jacek Anaszewski
2020-11-14  7:30   ` baskov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome