[PATCH] xf86/crtc: return 0 in xf86CompatOutput when compat_output is < 0

Maarten Lankhorst maarten.lankhorst at canonical.com
Mon Oct 8 03:32:16 PDT 2012


Commit 37d956e3ac9513 initializes compat_output to -1, so 
xf86CompatOutput would do config->output[-1] when not initialized.

This happens in xf86OutputSetEDID for example, before compat_output is set.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>

---
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 802303f..6e80210 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -730,6 +730,8 @@ static _X_INLINE xf86OutputPtr
 xf86CompatOutput(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+    if (config->compat_output < 0)
+        return NULL;
 
     return config->output[config->compat_output];
 }



More information about the xorg-devel mailing list