All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Video: fbdev - Fix possible NULL derefrence.
       [not found] <CGME20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c@epcas1p1.samsung.com>
@ 2017-01-30  5:12   ` Shailendra Verma
  0 siblings, 0 replies; 2+ messages in thread
From: Shailendra Verma @ 2017-01-30  5:00 UTC (permalink / raw)
  To: Tomi Valkeinen, LABBE Corentin, Julian Scheel, Julia Lawall,
	Boris Brezillon, linux-fbdev, linux-kernel, p.shailesh,
	ashish.kalra, Shailendra Verma, Shailendra Verma

of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/video/fbdev/ssd1307fb.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 2925d5c..bdf7d80 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -560,6 +560,10 @@ static int ssd1307fb_probe(struct i2c_client *client,
 	par->client = client;
 
 	par->device_info = of_device_get_match_data(&client->dev);
+	if (!par->device_info) {
+		dev_err(&client->dev, "no device match found\n");
+		return -ENODEV;
+	}
 
 	par->reset = of_get_named_gpio(client->dev.of_node,
 					 "reset-gpios", 0);
-- 
1.7.9.5

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

* [PATCH] Video: fbdev - Fix possible NULL derefrence.
@ 2017-01-30  5:12   ` Shailendra Verma
  0 siblings, 0 replies; 2+ messages in thread
From: Shailendra Verma @ 2017-01-30  5:12 UTC (permalink / raw)
  To: Tomi Valkeinen, LABBE Corentin, Julian Scheel, Julia Lawall,
	Boris Brezillon, linux-fbdev, linux-kernel, p.shailesh,
	ashish.kalra, Shailendra Verma, Shailendra Verma

of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/video/fbdev/ssd1307fb.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
index 2925d5c..bdf7d80 100644
--- a/drivers/video/fbdev/ssd1307fb.c
+++ b/drivers/video/fbdev/ssd1307fb.c
@@ -560,6 +560,10 @@ static int ssd1307fb_probe(struct i2c_client *client,
 	par->client = client;
 
 	par->device_info = of_device_get_match_data(&client->dev);
+	if (!par->device_info) {
+		dev_err(&client->dev, "no device match found\n");
+		return -ENODEV;
+	}
 
 	par->reset = of_get_named_gpio(client->dev.of_node,
 					 "reset-gpios", 0);
-- 
1.7.9.5


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

end of thread, other threads:[~2017-01-30  5:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170130050148epcas1p14f6149d6f0b6f24dc31506ede089724c@epcas1p1.samsung.com>
2017-01-30  5:00 ` [PATCH] Video: fbdev - Fix possible NULL derefrence Shailendra Verma
2017-01-30  5:12   ` Shailendra Verma

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.