From: "Michael S. Tsirkin" <mst@redhat.com>
To: Ken CC <ken.ccao@gmail.com>
Cc: yamahata@valinux.co.jp, avi@redhat.com, kvm@vger.kernel.org,
qemu-devel@nongnu.org
Subject: Re: [PATCH 2/4] pci init: fail qemu if devfn exceeding the max function number supported on bus
Date: Tue, 7 Sep 2010 20:19:24 +0300 [thread overview]
Message-ID: <20100907171924.GC18374@redhat.com> (raw)
In-Reply-To: <20100824132710.GB19469@kt>
On Tue, Aug 24, 2010 at 09:27:10PM +0800, Ken CC wrote:
> Check if devfn < PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE
>
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
> hw/pci.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index 9234fe3..fc4becd 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
> PCIConfigWriteFunc *config_write,
> bool is_bridge)
> {
> + assert(devfn / PCI_FUNCTIONS_PER_DEVICE < PCIBUS_MAX_DEVICES);
I guess it'll happen to work even for < 0, but it might be obvious
to only do this in >= 0 case.
Just remove the 'else' and stick the assert there.
> if (devfn < 0) {
> for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
> devfn += PCI_FUNC_MAX) {
next prev parent reply other threads:[~2010-09-07 17:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 13:25 [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h Ken CC
2010-08-24 13:27 ` [PATCH 2/4] pci init: fail qemu if devfn exceeding the max function number supported on bus Ken CC
2010-09-07 17:19 ` Michael S. Tsirkin [this message]
2010-08-24 13:27 ` [PATCH 3/4] Check pci slot number against PCIBUS_MAX_DEVICES in parse_pci_devfn Ken CC
2010-09-07 17:20 ` Michael S. Tsirkin
2010-08-24 13:28 ` [PATCH 4/4] Rename PCI_FUNC_MAX to PCI_FUNCTIONS_PER_DEVICES in pci.[ch] Ken CC
2010-09-07 17:22 ` Michael S. Tsirkin
2010-09-07 17:16 ` [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h Michael S. Tsirkin
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=20100907171924.GC18374@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=ken.ccao@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.