[PATCH] xfree86: Return NULL from xf86CompatOutput if no compat_output is defined

Jason Gerecke killertofu at gmail.com
Thu Apr 30 18:06:14 PDT 2015


If no compat_output is defined, we inadvertently (attempt to) return
whatever data is at index -1. Instead, return NULL since that's what
callers are expecting.

Signed-off-by: Jason Gerecke <jason.gerecke at wacom.com>
---
 hw/xfree86/modes/xf86Crtc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 3c5bbcf..8b01608 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -745,6 +745,8 @@ xf86CompatOutput(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 
+    if (config->compat_output < 0)
+        return NULL;
     return config->output[config->compat_output];
 }
 
-- 
2.3.5



More information about the xorg-devel mailing list