From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu, Jacopo Mondi <jacopo@jmondi.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] media: renesas-ceu: fix a potential NULL pointer dereference
Date: Sat, 9 Mar 2019 01:14:24 -0600 [thread overview]
Message-ID: <20190309071424.3600-1-kjlu@umn.edu> (raw)
In case of_match_device cannot find a match, the check returns
-EINVAL to avoid a potential NULL pointer dereference
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/media/platform/renesas-ceu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c
index 150196f7cf96..4aa807c0b6c7 100644
--- a/drivers/media/platform/renesas-ceu.c
+++ b/drivers/media/platform/renesas-ceu.c
@@ -1682,7 +1682,10 @@ static int ceu_probe(struct platform_device *pdev)
if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
ceu_data = of_match_device(ceu_of_match, dev)->data;
- num_subdevs = ceu_parse_dt(ceudev);
+ if (unlikely(!ceu_data))
+ num_subdevs = -EINVAL;
+ else
+ num_subdevs = ceu_parse_dt(ceudev);
} else if (dev->platform_data) {
/* Assume SH4 if booting with platform data. */
ceu_data = &ceu_data_sh4;
--
2.17.1
next reply other threads:[~2019-03-09 7:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-09 7:14 Kangjie Lu [this message]
2019-03-09 9:58 ` [PATCH] media: renesas-ceu: fix a potential NULL pointer dereference Jacopo Mondi
2019-03-28 15:30 ` Hans Verkuil
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=20190309071424.3600-1-kjlu@umn.edu \
--to=kjlu@umn.edu \
--cc=jacopo@jmondi.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pakki001@umn.edu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.