[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 2/7] pseries: Fix array overrun bug in PCI code
From: |
Alexander Graf |
Subject: |
[Qemu-stable] [PATCH 2/7] pseries: Fix array overrun bug in PCI code |
Date: |
Thu, 12 Jan 2012 18:35:26 +0100 |
From: David Gibson <address@hidden>
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 <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
(cherry picked from commit 135712de61dfa22368e98914d65b8b0860ec8505)
---
hw/spapr_pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index 7162588..9b6a032 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -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;
}
--
1.6.0.2
- [Qemu-stable] [PULL 1.0 0/7] ppc-stable-1.0 patch queue 2012-01-12, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 6/7] pseries: Populate "/chosen/linux, stdout-path" in the FDT, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 2/7] pseries: Fix array overrun bug in PCI code,
Alexander Graf <=
- [Qemu-stable] [PATCH 3/7] kvm-ppc: halt secondary cpus when guest reset, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 5/7] pseries: Add a routine to find a stable "default" vty and use it, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 7/7] pseries: Don't try to munmap() a malloc()ed TCE table, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 4/7] pseries: Emit device tree nodes in reg order, Alexander Graf, 2012/01/12
- [Qemu-stable] [PATCH 1/7] console: Fix segfault on screendump without VGA adapter, Alexander Graf, 2012/01/12