LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tuo Li <islituo@gmail.com>
To: a.hajda@samsung.com, mchehab@kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	baijiaju1990@gmail.com, Tuo Li <islituo@gmail.com>,
	TOTE Robot <oslab@tsinghua.edu.cn>
Subject: [PATCH] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()
Date: Thu,  5 Aug 2021 00:55:35 -0700	[thread overview]
Message-ID: <20210805075535.116097-1-islituo@gmail.com> (raw)

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


                 reply	other threads:[~2021-08-05  7:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805075535.116097-1-islituo@gmail.com \
    --to=islituo@gmail.com \
    --cc=a.hajda@samsung.com \
    --cc=baijiaju1990@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=oslab@tsinghua.edu.cn \
    --subject='Re: [PATCH] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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