From patchwork Tue Aug 24 06:48:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus Date: Mon, 23 Aug 2010 20:48:41 -0000 From: Ken CC X-Patchwork-Id: 62555 Message-Id: <20100824064841.GA11495@kt> To: kvm@vger.kernel.org Cc: yamahata@valinux.co.jp, qemu-devel@nongnu.org assert(devfn < PCIBUS_MAX_DEVICES) Signed-off-by: Ken CC --- hw/pci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 02019a1..1e804da 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, PCIConfigWriteFunc *config_write, bool is_bridge) { + assert(devfn < PCIBUS_MAX_DEVICES); if (devfn < 0) { for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices); devfn += PCI_FUNC_MAX) {