i830 modesetting driver SEGV fix

Krzysztof Halasa khc at pm.waw.pl
Sat Jan 27 07:12:29 PST 2007


Hi,

Not sure if posting (short) patches here is the best way to get them
applied... If I'm deeper into this a git push/pull/whatever would be
better. Anyway (xf86-video-intel, modesetting branch):

i830xf86GetConfigModes() produces modes with NULL name: mode->name
is assigned and then the entire mode struct is memset to 0. Xserver
crash.

diff --git a/src/i830_xf86Modes.c b/src/i830_xf86Modes.c
index 482a332..eb7a01e 100644
--- a/src/i830_xf86Modes.c
+++ b/src/i830_xf86Modes.c
@@ -567,6 +571,8 @@ i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
         mode = xalloc(sizeof(DisplayModeRec));
 	if (!mode)
 	    continue;
+
+        memset(mode, '\0', sizeof(DisplayModeRec));
         mode->name       = xstrdup(conf_mode->ml_identifier);
 	if (!mode->name)
 	{
@@ -574,7 +580,6 @@ i830xf86GetConfigModes (XF86ConfModeLinePtr conf_mode)
 	    continue;
 	}
 	
-        memset(mode,'\0',sizeof(DisplayModeRec));
 	mode->type       = 0;
         mode->Clock      = conf_mode->ml_clock;
         mode->HDisplay   = conf_mode->ml_hdisplay;

-- 
Krzysztof Halasa



More information about the xorg mailing list