mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: rcar-vin: fix a potential NULL pointer dereference
@ 2019-03-09  7:05 Kangjie Lu
  2019-03-09 11:02 ` Niklas Söderlund
  0 siblings, 1 reply; 3+ messages in thread
From: Kangjie Lu @ 2019-03-09  7:05 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Niklas Söderlund, Mauro Carvalho Chehab,
	linux-media, linux-renesas-soc, linux-kernel

In case of_match_node cannot find a match, the fix returns
-EINVAL to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/media/platform/rcar-vin/rcar-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c
index f0719ce24b97..a058e2023ca8 100644
--- a/drivers/media/platform/rcar-vin/rcar-core.c
+++ b/drivers/media/platform/rcar-vin/rcar-core.c
@@ -266,6 +266,8 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin)
 
 	match = of_match_node(vin->dev->driver->of_match_table,
 			      vin->dev->of_node);
+	if (unlikely(!match))
+		return -EINVAL;
 
 	strscpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name));
 	strscpy(mdev->model, match->compatible, sizeof(mdev->model));
-- 
2.17.1


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

end of thread, other threads:[~2019-03-28 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  7:05 [PATCH] media: rcar-vin: fix a potential NULL pointer dereference Kangjie Lu
2019-03-09 11:02 ` Niklas Söderlund
2019-03-28 15:26   ` Hans Verkuil

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

all inboxes | Powered by JetHome®