[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 4/6] tests/libqos: Check for valid dev pointer when l
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 4/6] tests/libqos: Check for valid dev pointer when looking for PCI devices |
Date: |
Mon, 5 Mar 2018 09:40:04 +0000 |
From: Thomas Huth <address@hidden>
dev could be NULL if the PCI device can not be found due to some
reasons, so we must not dereference the pointer in this case.
Signed-off-by: Thomas Huth <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
tests/libqos/virtio-pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 7ac15c04e1..550dede0a2 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -315,7 +315,9 @@ QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus,
uint16_t device_type)
qvirtio_pci_foreach(bus, device_type, false, 0,
qvirtio_pci_assign_device, &dev);
- dev->vdev.bus = &qvirtio_pci;
+ if (dev) {
+ dev->vdev.bus = &qvirtio_pci;
+ }
return dev;
}
--
2.14.3
- [Qemu-devel] [PULL 0/6] Block patches, Stefan Hajnoczi, 2018/03/05
- [Qemu-devel] [PULL 4/6] tests/libqos: Check for valid dev pointer when looking for PCI devices,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 2/6] util/uri.c: remove brackets that wrap `return` statement's content., Stefan Hajnoczi, 2018/03/05
- [Qemu-devel] [PULL 5/6] Add a git-publish configuration file, Stefan Hajnoczi, 2018/03/05
- [Qemu-devel] [PULL 3/6] util/uri.c: wrap single statement blocks with braces {}, Stefan Hajnoczi, 2018/03/05
- [Qemu-devel] [PULL 6/6] README: Document 'git-publish' workflow, Stefan Hajnoczi, 2018/03/05
- [Qemu-devel] [PULL 1/6] util/uri.c: Coding style check, Only whitespace involved, Stefan Hajnoczi, 2018/03/05
- Re: [Qemu-devel] [PULL 0/6] Block patches, no-reply, 2018/03/05
- Re: [Qemu-devel] [PULL 0/6] Block patches, Peter Maydell, 2018/03/05