From 88820f1c7b66cbc98d3f19efca24c9f52410d9f9 Mon Sep 17 00:00:00 2001 From: Emily Deng Date: Mon, 25 Jul 2016 16:12:53 +0800 Subject: [PATCH] xfree86: vgaarb: Initialize local variable rsrc_decodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In function xf86VGAarbiterScrnInit when the "pEnt->bus.type" is BUS_PLATFORM, the "pScrn->vgaDev" won't be set, so the "pScrn->vgaDev" is equal to zero. The variable "rsrc_decodes" in function "xf86VGAarbiterAllowDRI" is not initialized. So it will occur error when "pScrn->vgaDev == 0", and "vga_count > 1". For this case, as "pScrn->vgaDev == 0", the function "pci_device_vgaarb_get_info" will only set the value of "vga_count", but won't set the value of "rsrc_decodes", so it will has two different return values for function "xf86VGAarbiterAllowDRI" in different platforms. One platform will return TRUE, as the "rsrc_decodes" 's default value is 0, but another platform will return FALSE, as the "rsrc_decodes" 's default value is "32767", this will cause disable direct rendering. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96937 Signed-off-by: Emily Deng Reviewed-by: Michel Dänzer --- hw/xfree86/common/xf86VGAarbiter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c index 29a5f8512..40f241aee 100644 --- a/hw/xfree86/common/xf86VGAarbiter.c +++ b/hw/xfree86/common/xf86VGAarbiter.c @@ -105,7 +105,7 @@ Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen) { int vga_count; - int rsrc_decodes; + int rsrc_decodes = 0; ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); if (vga_no_arb)