Patchwork [1/8] virtio-pci: Check for virtio_blk_init() failure

login
register
mail settings
Submitter Markus Armbruster
Date July 6, 2010, 12:37 p.m.
Message ID <1278419869-26126-2-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/58018/
State New
Headers show

Comments

Markus Armbruster - July 6, 2010, 12:37 p.m.
It can't actually fail now, but the next commit will change that.

s390_virtio_blk_init() already checks for failure, but
virtio_blk_init_pci() doesn't.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Christoph Hellwig - July 7, 2010, 1:32 a.m.
Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c6ef825..c6edcc2 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -552,6 +552,9 @@  static int virtio_blk_init_pci(PCIDevice *pci_dev)
         return -1;
     }
     vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
+    if (!vdev) {
+        return -1;
+    }
     vdev->nvectors = proxy->nvectors;
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,