From: Ken CC <ken.ccao@gmail.com>
To: yamahata@valinux.co.jp, avi@redhat.com, kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org, mst@redhat.com
Subject: [Qemu-devel] [PATCH 3/4] Check pci slot number against PCIBUS_MAX_DEVICES in parse_pci_devfn
Date: Tue, 24 Aug 2010 21:27:41 +0800 [thread overview]
Message-ID: <20100824132741.GC19469@kt> (raw)
In-Reply-To: <20100824132525.GA19469@kt>
If pci addr provided from command line is bigger than 32,
PCIBUS_MAX_DEVICES, return error -EINVAL.
32 << 3 | 7 == 256 (PCIBUS_MAX_FUNCTIONS)
PCIBUS_MAX_FUNCTIONS = PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE
Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
hw/qdev-properties.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 9219cd7..565fd08 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -1,5 +1,5 @@
#include "net.h"
-#include "qdev.h"
+#include "pci.h"
#include "qerror.h"
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop)
@@ -514,6 +514,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
return -EINVAL;
}
}
+ if (slot >= PCIBUS_MAX_DEVICES)
+ return -EINVAL;
if (str[n] != '\0')
return -EINVAL;
if (fn > 7)
next prev parent reply other threads:[~2010-08-24 13:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 13:25 [Qemu-devel] [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h Ken CC
2010-08-24 13:27 ` [Qemu-devel] [PATCH 2/4] pci init: fail qemu if devfn exceeding the max function number supported on bus Ken CC
2010-09-07 17:19 ` [Qemu-devel] " Michael S. Tsirkin
2010-08-24 13:27 ` Ken CC [this message]
2010-09-07 17:20 ` [Qemu-devel] Re: [PATCH 3/4] Check pci slot number against PCIBUS_MAX_DEVICES in parse_pci_devfn Michael S. Tsirkin
2010-08-24 13:28 ` [Qemu-devel] [PATCH 4/4] Rename PCI_FUNC_MAX to PCI_FUNCTIONS_PER_DEVICES in pci.[ch] Ken CC
2010-09-07 17:22 ` [Qemu-devel] " Michael S. Tsirkin
2010-09-07 17:16 ` [Qemu-devel] Re: [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=20100824132741.GC19469@kt \
--to=ken.ccao@gmail.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--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 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).