diff options
author | Chris Wright <chrisw@sous-sol.org> | 2008-04-21 16:02:49 -0700 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-22 14:20:54 +0300 |
commit | add9c7bbe3c9e89823e81f375ba5498196498a22 (patch) | |
tree | 243869f9ce4159e21f62f556e82044711d2f0363 | |
parent | 8ddc805d220f8693a4708f403e82e67f874513bd (diff) |
Virtio-blk: virtio_pci_init can fail
The pci_device_register() call in virtio_pci_init() can fail.
Handle this error condition instead of generating a SEGV.
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | hw/virtio-blk.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 786a57bf7..3af36db9d 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -163,6 +163,8 @@ void *virtio_blk_init(PCIBus *bus, uint16_t vendor, uint16_t device, 0, VIRTIO_ID_BLOCK, 0x01, 0x80, 0x00, sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); + if (!s) + return NULL; s->vdev.update_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; |