Skip to contentSkip to conversation

fbdev: Initialize var structure in calc_mode_timings

PATCH In review Antonino A. Daplas 1 participant 1 message Sep 1, 2005 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 6/10 fbdev: Initialize var structure in calc_mode_timings

The var structure in calc_mode_timings is not properly initialized (zero set) which leads to undefined behavior when it is passed to fb_get_mode().

---
 fbmon.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)
drivers/video/fbmon.c +3 -1
@@ -314,11 +314,13 @@ static int edid_is_monitor_block(unsigne
 		return 0;
 }
 
-static void calc_mode_timings(int xres, int yres, int refresh, struct fb_videomode *mode)
+static void calc_mode_timings(int xres, int yres, int refresh,
+			      struct fb_videomode *mode)
 {
 	struct fb_var_screeninfo var;
 	struct fb_info info;
 	
+	memset(&var, 0, sizeof(struct fb_var_screeninfo));
 	var.xres = xres;
 	var.yres = yres;
 	fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, 

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf