diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2011-01-22 10:53:08 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2011-01-22 10:53:08 -0500 |
commit | 6fc7cf1eb6d0c873e5a0b794aac9b2a798fce25b (patch) | |
tree | f2fe3cd62598ffdf8e44db5934dddf6d95acefae | |
parent | f5154e2395db92bcaa9c86d483bd68d8fb2fbab2 (diff) |
Fix to prevent infinite loop in build_pci_path().
Make sure the PCI path doesn't point to itself.
-rw-r--r-- | src/pci.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } } } |