From: David Gibson <dwg@au1.ibm.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] pseries: Fix possible out-of-bounds error
Date: Tue, 29 Nov 2011 17:11:13 +1100 [thread overview]
Message-ID: <20111129061113.GJ3508@truffala.fritz.box> (raw)
In-Reply-To: <4ED3CA9D.4030202@weilnetz.de>
On Mon, Nov 28, 2011 at 06:53:33PM +0100, Stefan Weil wrote:
> Am 21.11.2011 20:25, schrieb Stefan Weil:
> >PCI_NUM_REGIONS is 7, ARRAY_SIZE(bars) is 6. Either bars must be
> >extended by a 7th array element, or the loop which reads bars[i]
> >must terminate before it tries to read bars[6].
> >
> >For dev->io_regions[6].size == 0, the old code also works,
> >but it is not obvious whether this is always true.
> >
> >This bug was detected by cppcheck.
> >
> >Cc: David Gibson<david@gibson.dropbear.id.au>
> >Signed-off-by: Stefan Weil<sw@weilnetz.de>
> >---
> > 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..cefde38 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< PCI_NUM_REGIONS&& i< ARRAY_SIZE(bars); ++i) {
> > if (0 == dev->io_regions[i].size) {
> > continue;
> > }
>
> Ping? Can this be fixed in QEMU 1.0?
Sorry, for some reason I missed the initial post of this patch.
Alexey who wrote most of the spapr_pci code actually found and fixed
this already, but we had a bit of a miscommunication so I hadn't
realised to send it upstream yet. I'll send a fix shortly for 1.0.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
prev parent reply other threads:[~2011-11-29 6:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 19:25 [Qemu-devel] [PATCH] pseries: Fix possible out-of-bounds error Stefan Weil
2011-11-28 17:53 ` Stefan Weil
2011-11-29 6:11 ` David Gibson [this message]
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=20111129061113.GJ3508@truffala.fritz.box \
--to=dwg@au1.ibm.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).