From caa82f7074a0bf99658638b8ca26728c39d3a3dc Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 26 May 2011 18:05:50 +0000 Subject: [PATCH] * Don't try to check devices that are obviously not on PCI anymore. * Fix a warning about pci_address::segment potentially being used uninitialized. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41760 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/arch/x86/irq_routing_table.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/system/kernel/arch/x86/irq_routing_table.cpp b/src/system/kernel/arch/x86/irq_routing_table.cpp index 93d7146316..4775649595 100644 --- a/src/system/kernel/arch/x86/irq_routing_table.cpp +++ b/src/system/kernel/arch/x86/irq_routing_table.cpp @@ -462,6 +462,7 @@ ensure_all_functions_matched(pci_module_info* pci, uint8 bus, == PCI_header_type_PCI_to_PCI_bridge) { pci_address pciAddress; + pciAddress.segment = 0; pciAddress.bus = bus; pciAddress.device = device; pciAddress.function = function; @@ -579,6 +580,13 @@ read_irq_routing_table_recursive(acpi_module_info* acpi, pci_module_info* pci, pciAddress.function = 0; } + if (pciAddress.device >= kMaxPCIDeviceCount + || pciAddress.function >= kMaxPCIFunctionCount) { + // we don't seem to be on the PCI bus anymore + // (just a different type of device) + return B_OK; + } + uint8 headerType = pci->read_pci_config(pciAddress.bus, pciAddress.device, pciAddress.function, PCI_header_type, 1);