* [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices
@ 2018-02-27 6:44 Thomas Huth
2018-02-27 16:27 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2018-02-27 6:44 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
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 <thuth@redhat.com>
---
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 7ac15c0..550dede 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;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices
2018-02-27 6:44 [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices Thomas Huth
@ 2018-02-27 16:27 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-02-27 16:27 UTC (permalink / raw)
To: Thomas Huth; +Cc: qemu-devel, qemu-trivial
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Tue, Feb 27, 2018 at 07:44:44AM +0100, Thomas Huth wrote:
> 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 <thuth@redhat.com>
> ---
> tests/libqos/virtio-pci.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
There is no maintainer for tests/libqos/virtio-pci.c in MAINTAINERS so
I'll take this patch.
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-27 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 6:44 [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices Thomas Huth
2018-02-27 16:27 ` Stefan Hajnoczi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.