From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices
Date: Tue, 27 Feb 2018 07:44:44 +0100 [thread overview]
Message-ID: <1519713884-2346-1-git-send-email-thuth@redhat.com> (raw)
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
next reply other threads:[~2018-02-27 6:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-27 6:44 Thomas Huth [this message]
2018-02-27 16:27 ` [Qemu-devel] [PATCH] tests/libqos: Check for valid dev pointer when looking for PCI devices Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519713884-2346-1-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).