From: Chris W. <ch...@so...> - 2008-04-21 23:05:32
|
The pci_device_register() call in virtio_pci_init() can fail. Handle this error condition instead of generating a SEGV. Cc: Marcelo Tosatti <mto...@re...> Signed-off-by: Chris Wright <ch...@so...> --- 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; -- |