From: Alexander Graf <agraf@suse.de>
To: qemu-devel Developers <qemu-devel@nongnu.org>
Cc: jmforbes@linuxtx.org, qemu-stable@nongnu.org,
David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 2/7] pseries: Fix array overrun bug in PCI code
Date: Thu, 12 Jan 2012 18:35:26 +0100 [thread overview]
Message-ID: <1326389731-1694-3-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1326389731-1694-1-git-send-email-agraf@suse.de>
From: David Gibson <david@gibson.dropbear.id.au>
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
next prev parent reply other threads:[~2012-01-12 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 17:35 [Qemu-devel] [PULL 1.0 0/7] ppc-stable-1.0 patch queue 2012-01-12 Alexander Graf
2012-01-12 17:35 ` [Qemu-devel] [PATCH 1/7] console: Fix segfault on screendump without VGA adapter Alexander Graf
2012-01-12 17:35 ` Alexander Graf [this message]
2012-01-12 17:35 ` [Qemu-devel] [PATCH 3/7] kvm-ppc: halt secondary cpus when guest reset Alexander Graf
2012-01-12 17:35 ` [Qemu-devel] [PATCH 4/7] pseries: Emit device tree nodes in reg order Alexander Graf
2012-01-12 17:35 ` [Qemu-devel] [PATCH 5/7] pseries: Add a routine to find a stable "default" vty and use it Alexander Graf
2012-01-12 17:35 ` [Qemu-devel] [PATCH 6/7] pseries: Populate "/chosen/linux, stdout-path" in the FDT Alexander Graf
2012-01-12 17:35 ` [Qemu-devel] [PATCH 7/7] pseries: Don't try to munmap() a malloc()ed TCE table Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326389731-1694-3-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=jmforbes@linuxtx.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).