SHA256
1
0
forked from pool/qemu
qemu/0040-pseries-Fix-array-overrun-bug-in-PCI-code.patch
Alexander Graf a799f071ba - qemu-user: add fix for deadloop with ulimit constraints
- qemu-user: add device mapper and loopback ioctls, enabling kpatkx

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=40
2012-01-31 23:10:40 +00:00

34 lines
1.2 KiB
Diff

From 632e46dfa29a19ba656a5580b610fda0003cf3b0 Mon Sep 17 00:00:00 2001
From: David Gibson <david@gibson.dropbear.id.au>
Date: Mon, 28 Nov 2011 20:21:39 +0000
Subject: [PATCH] pseries: Fix array overrun bug in PCI code
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 <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
(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