All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: tegra: fix a possible NULL dereference
@ 2015-11-12  7:26 LABBE Corentin
  2015-11-12 12:29 ` Thierry Reding
  0 siblings, 1 reply; 18+ messages in thread
From: LABBE Corentin @ 2015-11-12  7:26 UTC (permalink / raw)
  To: gnurou, ldewangan, swarren, thierry.reding, wsa
  Cc: LABBE Corentin, linux-i2c, linux-kernel, linux-tegra

of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 809:
i2c_dev->hw = match->data;

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a0522fc..c803551 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -806,7 +806,10 @@ static int tegra_i2c_probe(struct platform_device *pdev)
 
 	if (pdev->dev.of_node) {
 		const struct of_device_id *match;
+
 		match = of_match_device(tegra_i2c_of_match, &pdev->dev);
+		if (!match)
+			return -ENODEV;
 		i2c_dev->hw = match->data;
 		i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
 						"nvidia,tegra20-i2c-dvc");
-- 
2.4.10

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

end of thread, other threads:[~2016-01-23 11:07 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12  7:26 [PATCH] i2c: tegra: fix a possible NULL dereference LABBE Corentin
2015-11-12 12:29 ` Thierry Reding
2015-11-12 12:54   ` LABBE Corentin
2015-11-12 13:28     ` Thierry Reding
2015-11-12 13:28       ` Thierry Reding
2015-11-12 13:45       ` Uwe Kleine-König
     [not found]         ` <20151112134519.GJ24008-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-11-12 13:55           ` Thierry Reding
2015-11-12 13:55             ` Thierry Reding
2015-11-12 14:54             ` LABBE Corentin
2015-11-12 16:14               ` Thierry Reding
2015-11-12 16:14                 ` Thierry Reding
2016-01-23 11:07               ` Wolfram Sang
2016-01-23 11:07                 ` Wolfram Sang
2016-01-23 10:56           ` Wolfram Sang
2016-01-23 10:56             ` Wolfram Sang
2015-11-12 13:40   ` Jon Hunter
2015-11-12 13:40     ` Jon Hunter
2015-11-12 13:55     ` Thierry Reding

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.