From: Kevin O'Connor Date: Sat, 22 Jan 2011 15:53:08 +0000 (-0500) Subject: Fix to prevent infinite loop in build_pci_path(). X-Git-Tag: rel-0.6.2~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6fc7cf1eb6d0c873e5a0b794aac9b2a798fce25b;p=seabios.git Fix to prevent infinite loop in build_pci_path(). Make sure the PCI path doesn't point to itself. --- diff --git a/src/pci.c b/src/pci.c index 45f210d..944a393 100644 --- a/src/pci.c +++ b/src/pci.c @@ -194,7 +194,7 @@ pci_path_setup(void) PCIpaths = malloc_tmp(sizeof(*PCIpaths) * 256); if (!PCIpaths) return; - memset(PCIpaths, 0, sizeof(PCIpaths)); + memset(PCIpaths, 0, sizeof(*PCIpaths) * 256); int roots = 0; int bdf, max; @@ -209,7 +209,8 @@ pci_path_setup(void) if (v == PCI_HEADER_TYPE_BRIDGE || v == PCI_HEADER_TYPE_CARDBUS) { v = pci_config_readl(bdf, PCI_PRIMARY_BUS); int childbus = (v >> 8) & 0xff; - PCIpaths[childbus] = bdf | PP_PCIBRIDGE; + if (childbus > bus) + PCIpaths[childbus] = bdf | PP_PCIBRIDGE; } } }