diff mbox

[2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus

Message ID 20100824063351.GB10815@kt
State New
Headers show

Commit Message

Ken CC Aug. 24, 2010, 6:33 a.m. UTC
assert(devfn < PCIBUS_MAX_DEVICES)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Ken CC Aug. 24, 2010, 6:51 a.m. UTC | #1
broken thread, please ignore.

On Tue, Aug 24, 2010 at 02:33:51PM +0800, Ken CC wrote:
> assert(devfn < PCIBUS_MAX_DEVICES)
> 
> 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 02019a1..1e804da 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 < PCIBUS_MAX_DEVICES);
>      if (devfn < 0) {
>          for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
>              devfn += PCI_FUNC_MAX) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
diff mbox

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 02019a1..1e804da 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 < PCIBUS_MAX_DEVICES);
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
             devfn += PCI_FUNC_MAX) {