]> Git Repo - qemu.git/commitdiff
pseries: Fix array overrun bug in PCI code
authorDavid Gibson <[email protected]>
Tue, 29 Nov 2011 06:21:39 +0000 (07:21 +0100)
committerAndrzej Zaborowski <[email protected]>
Mon, 5 Dec 2011 20:38:50 +0000 (21:38 +0100)
spapr_populate_pci_devices() containd a loop with PCI_NUM_REGIONS (7)
iterations.  However this overruns the 'bars' global array, which only has
6 elements. In fact we only want to run this loop for things listed in the
bars array, so this patch corrects the loop bounds to reflect that.

Signed-off-by: David Gibson <[email protected]>
Signed-off-by: Andrzej Zaborowski <[email protected]>
hw/spapr_pci.c

index 7162588543167b51aa9a6a3201b6cccd1b01d945..9b6a032ccecc8d44320b87dfa4a50f73f6d02d3d 100644 (file)
@@ -454,7 +454,7 @@ int spapr_populate_pci_devices(sPAPRPHBState *phb,
         reg[0].size = 0;
 
         n = 0;
-        for (i = 0; i < PCI_NUM_REGIONS; ++i) {
+        for (i = 0; i < ARRAY_SIZE(bars); ++i) {
             if (0 == dev->io_regions[i].size) {
                 continue;
             }
This page took 0.028082 seconds and 4 git commands to generate.