Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569393

[PATCH] Video: fbdev - Fix possible NULL derefrence.

From Shailendra Verma <shailendra.v@samsung.com>
Newsgroups linux.kernel
Subject [PATCH] Video: fbdev - Fix possible NULL derefrence.
Date 2017-01-30 06:10 +0100
Message-ID <t5co1-8ip-25@gated-at.bofh.it> (permalink)
References <t5co1-8ip-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] Video: fbdev - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-30 06:10 +0100

csiph-web