]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio pmem: fix wrong mem region condition
authorPankaj Gupta <pagupta@redhat.com>
Fri, 12 Jul 2019 07:35:52 +0000 (13:05 +0530)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 12 Jul 2019 14:56:27 +0000 (10:56 -0400)
Coverity reported memory region returns zero
for non-null value. This is because of wrong
arguments to '?:' , fixing this.

Signed-off-by: Pankaj Gupta <pagupta@redhat.com>
Message-Id: <20190712073554.21918-2-pagupta@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
hw/virtio/virtio-pmem-pci.c

index 8b2d0dbccc5fad513ff9ed76012744b5558138d9..0da66274692258ad7e5e43dfa8aec493cfd5afb8 100644 (file)
@@ -57,7 +57,7 @@ static uint64_t virtio_pmem_pci_get_plugged_size(const MemoryDeviceState *md,
     MemoryRegion *mr = vpc->get_memory_region(pmem, errp);
 
     /* the plugged size corresponds to the region size */
-    return mr ? 0 : memory_region_size(mr);
+    return mr ? memory_region_size(mr) : 0;
 }
 
 static void virtio_pmem_pci_fill_device_info(const MemoryDeviceState *md,