From: Yi Min Zhao Date: Fri, 5 Aug 2016 09:00:35 +0000 (+0800) Subject: s390x/pci: fix null pointer bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7fc0abf4cb740609e802611690a3cdb7ff5f21bd;p=qemu.git s390x/pci: fix null pointer bug We should make sure that it's not NULL firstly. Signed-off-by: Yi Min Zhao Reviewed-by: Cornelia Huck Signed-off-by: Cornelia Huck --- diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index 47ca853bd2..9c1c04e590 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -712,7 +712,7 @@ static void s390_pcihost_hot_unplug(HotplugHandler *hotplug_dev, pci_dev = PCI_DEVICE(dev); for (i = 0 ; i < PCI_SLOT_MAX; i++) { - if (s->pbdev[i]->pdev == pci_dev) { + if (s->pbdev[i] && s->pbdev[i]->pdev == pci_dev) { pbdev = s->pbdev[i]; break; }