The pci_device_register() call in virtio_pci_init() can fail.
Handle this error condition instead of generating a SEGV.

Cc: Marcelo Tosatti <[EMAIL PROTECTED]>
Signed-off-by: Chris Wright <[EMAIL PROTECTED]>
---
 qemu/hw/virtio-blk.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -163,6 +163,8 @@ void *virtio_blk_init(PCIBus *bus, uint1
                                       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;

-- 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to