ioemu: fix the devices loop.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jul 2008 10:20:01 +0000 (11:20 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jul 2008 10:20:01 +0000 (11:20 +0100)
Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Signed-off-by: Yuji Shimada <shimada-yxb@necst.nec.co.jp>
tools/ioemu/hw/pci.c

index 4f55d1da078b7d849b6289f25dcbdb621d59bb3d..b68dd3f91a5c2df5b174adf0a4ba8859937ff278 100644 (file)
@@ -644,17 +644,21 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint32_t id,
 
 int pt_chk_bar_overlap(PCIBus *bus, int devfn, uint32_t addr, uint32_t size)
 {
-    PCIDevice *devices = (PCIDevice *)bus->devices;
+    PCIDevice *devices = NULL;
     PCIIORegion *r;
     int ret = 0;
     int i, j;
 
     /* check Overlapped to Base Address */
-    for (i=0; i<256; i++, devices++)
+    for (i=0; i<256; i++)
     {
-        if ((devices == NULL) || (devices->devfn == devfn))
+        if ( !(devices = bus->devices[i]) )
             continue;
 
+        /* skip itself */
+        if (devices->devfn == devfn)
+            continue;
+        
         for (j=0; j<PCI_NUM_REGIONS; j++)
         {
             r = &devices->io_regions[j];