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>
This commit is contained in:
parent
e35f29ded3
commit
b645000e1a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user