From f8192e1c612244ae7314fa9f08b3a2a98f12cc19 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 9 Jan 2012 13:37:30 +0100 Subject: [PATCH 3/9] virtio-pci: Check for virtio_blk_init() failure RH-Author: Markus Armbruster Message-id: <1326116256-3685-4-git-send-email-armbru@redhat.com> Patchwork-id: 36288 O-Subject: [RHEL-6.3 PATCH qemu-kvm 3/9] virtio-pci: Check for virtio_blk_init() failure Bugzilla: 737879 RH-Acked-by: Paolo Bonzini RH-Acked-by: Kevin Wolf RH-Acked-by: Amit Shah 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 Signed-off-by: Kevin Wolf (cherry picked from commit ac0c14d71b68ac18f03a876028e332534e1e6a3e) --- hw/virtio-pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- hw/virtio-pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index ee5d2a8..8457b1a 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -813,6 +813,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, -- 1.7.7.4