summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-03-02 12:49:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-09 08:30:46 +0100
commit09d11c546738a00754c9f1a9b726ddd14f5b5b38 (patch)
tree9380c75b7be1a5a9d5e4fcaf25dc17f73f86f143 /drivers
parenta171453d18b65359c6d35f4d0877145be9e896b7 (diff)
downloadbarebox-09d11c546738a00754c9f1a9b726ddd14f5b5b38.tar.gz
video/ssd1307fb: fix NULL pointer dereference in probe
info->priv is dereferenced before a valid value has been set leading to a NULL pointer dereference in the probe function. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/ssd1307fb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/video/ssd1307fb.c b/drivers/video/ssd1307fb.c
index 70077e4..83a561a 100644
--- a/drivers/video/ssd1307fb.c
+++ b/drivers/video/ssd1307fb.c
@@ -405,8 +405,9 @@ static int ssd1307fb_probe(struct device_d *dev)
}
info = xzalloc(sizeof(struct fb_info));
+ par = xzalloc(sizeof(*par));
- par = info->priv;
+ info->priv = par;
par->info = info;
par->client = client;
@@ -574,6 +575,7 @@ reset_oled_error:
free(vmem);
fb_alloc_error:
regulator_disable(par->vbat);
+ free(par);
free(info);
return ret;
}