pci init: Check if devfn exceeding the max devices number supported on bus
A message that is not in the archive (sent off-list or not yet received): 20100812091551.32612.14893.stgit@k1
PATCH 1/1 pci init: Check if devfn exceeding the max devices number supported on bus
Check before trying subindexing.
Signed-off-by Ken CC <[email protected]>
--- hw/pci.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
hw/pci.c +4 -0
@@ -675,6 +675,10 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,error_report ("PCI: no slot/function available for %s, all in use" , name);return NULL ; found: ; + }else if (devfn >PCIBUS_MAX_DEVICES -1 ) { +error_report ("PCI: devfn is out of bus capacity." +" Only %d devices supported." ,PCIBUS_MAX_DEVICES ); +return NULL ; }else if (bus->devices[devfn]) {error_report ("PCI: slot %d function %d not available for %s, in use by %s" ,PCI_SLOT (devfn),PCI_FUNC (devfn), name, bus->devices[devfn]->name);