Skip to contentSkip to conversation

video: fbdev: pxafb: potential NULL dereference on error

PATCH In review Dan Carpenter 3 participants 3 messages Jul 15, 2016 – Aug 10, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: fbdev: pxafb: potential NULL dereference on error

If we "goto out;" then it calls display_timings_release(timings); Since "timings" is NULL, that's going to oops. Just return directly.

Fixes 420a488278e8 ('video: fbdev: pxafb: initial devicetree conversion')
drivers/video/fbdev/pxafb.c +1 -1
index 2c0487f..ed41fdb 100644
@@ -2125,7 +2125,7 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
 
 	timings = of_get_display_timings(disp);
 	if (!timings)
-		goto out;
+		return -EINVAL;
 
 	ret = -ENOMEM;
 	info->modes = kmalloc_array(timings->num_timings,
#2 lore raw
In reply to Dan Carpenter
Quoted 12 lines · Dan Carpenter

If we "goto out;" then it calls display_timings_release(timings); Since "timings" is NULL, that's going to oops. Just return directly.

Fixes 420a488278e8 ('video: fbdev: pxafb: initial devicetree conversion')
drivers/video/fbdev/pxafb.c +0 -0
index 2c0487f..ed41fdb 100644

drivers/video/fbdev/pxafb.c static int of_get_pxafb_display(struct device *dev, struct device_node *disp, · line 2131

Quoted 8 lines
drivers/video/fbdev/pxafb.c +1 -1
@@ -2125,7 +2125,7 @@ static int of_get_pxafb_display(struct device *dev, struct device_node *disp,
 
 	timings = of_get_display_timings(disp);
 	if (!timings)
-		goto out;
+		return -EINVAL;
 
 	ret = -ENOMEM;
 	info->modes = kmalloc_array(timings->num_timings,

Thanks, queued for v4.9.

Tomi