Video: fbdev - Fix possible NULL derefrence.

Started by Shailendra Verma on Jan 30, 2017

Subsystems (2)

Maintainers (2)

DORMANTno replies

open the first message on its own page

Message details and related content
of_device_get_match_data could return NULL, and so can cause
a NULL pointer dereference later.

Signed-off-by: Shailendra Verma <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help