LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
@ 2021-08-05  7:55 Tuo Li
  0 siblings, 0 replies; only message in thread
From: Tuo Li @ 2021-08-05  7:55 UTC (permalink / raw)
  To: a.hajda, mchehab
  Cc: linux-arm-kernel, linux-media, linux-kernel, baijiaju1990,
	Tuo Li, TOTE Robot

The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is 
checked in:
  if (!dev->plat_dev)

This indicates both dev->plat_dev and pdev can be NULL. If so, the 
function dev_err() is called to print error infomation.
  dev_err(&pdev->dev, "No platform data specified\n");

However, &pdev->dev is an illegal address, and it is dereferenced in 
dev_err().

To fix this possible null-pointer dereference, replace dev_err() with 
mfc_err().

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Tuo Li <islituo@gmail.com>
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index eba2b9f040df..c763c0a03140 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1283,7 +1283,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)
 	spin_lock_init(&dev->condlock);
 	dev->plat_dev = pdev;
 	if (!dev->plat_dev) {
-		dev_err(&pdev->dev, "No platform data specified\n");
+		mfc_err("No platform data specified\n");
 		return -ENODEV;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-05  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  7:55 [PATCH] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe() Tuo Li

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).