[PATCH] fix seg fault in xf86scanpci

Magolan, John F John.Magolan at unisys.com
Fri Apr 6 08:56:25 PDT 2007


There's a problem in xf86scanpci that causes a seg fault on large
systems.  The pci_devp[] array is defined at compile time to have
MAX_PCI_DEVICES + 1 elements.  The loop counter variable xf86MaxPciDevs
is initialized to be MAX_PCI_DEVICES, but at run time is set to the
actual number of buses in the system (in linuxPci.c).  On large systems,
it is easy for that number to exceed the number of array elements (which
causes a seg fault when scanning all the buses).

 

We opened bugzilla 10534 but haven't yet seen any responses to it.  My
co-worker Dan Yeisley has written a patch (see below) that fixes the
problem.  

 

diff -Naur xorg-server-1.1.1/hw/xfree86/os-support/bus/linuxPci.c
xorg-dpy/hw/xfree86/os-support/bus/linuxPci.c

--- xorg-server-1.1.1/hw/xfree86/os-support/bus/linuxPci.c  2007-04-05
11:07:39.000000000 -0400

+++ xorg-dpy/hw/xfree86/os-support/bus/linuxPci.c     2007-04-05
11:09:18.000000000 -0400

@@ -126,7 +126,9 @@

      pciFindFirstFP = pciGenFindFirst;

      pciFindNextFP  = pciGenFindNext;

      pciSetOSBIOSPtr(linuxPciHandleBIOS);

-     xf86MaxPciDevs = lnxPciInit();

+     

+     if (lnxPciInit() < xf86MaxPciDevs)

+           xf86MaxPciDevs = lnxPciInit();

 }

 

 static int

 

 

 

John Magolan

Unisys Tredyffrin K205-4

 

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

 

"You know, the only way I've found to make these pictures is with
animators. You can't seem to do it with accountants and bookkeepers."
-Walt Disney

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20070406/2d2f3355/attachment.html>


More information about the xorg mailing list