diff options
author | Saravanakumar <saravanakumar.punith@gmail.com> | 2014-05-22 17:03:50 +0530 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2014-05-24 00:10:29 +0400 |
commit | b645000e1ac430601eddb0b435936837aea94bb4 (patch) | |
tree | 669dfb40e7deaa9628eb5db797f93fd0785eded7 /hw | |
parent | e35f29ded3602a2ff6776290787c596ce6afc802 (diff) | |
download | qemu-b645000e1ac430601eddb0b435936837aea94bb4.zip qemu-b645000e1ac430601eddb0b435936837aea94bb4.tar.gz qemu-b645000e1ac430601eddb0b435936837aea94bb4.tar.bz2 |
pci: move dereferencing of root only after verifying valid root pointer
Signed-off-by: Saravanakumar <saravanakumar.punith@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci/pci.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 22fe5ee..8d6a8d4 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -605,13 +605,13 @@ PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr) int dom, bus; unsigned slot; - assert(!root->parent_dev); - if (!root) { fprintf(stderr, "No primary PCI bus\n"); return NULL; } + assert(!root->parent_dev); + if (!devaddr) { *devfnp = -1; return pci_find_bus_nr(root, 0); |