diff options
author | Pankaj Gupta <pagupta@redhat.com> | 2019-07-12 13:05:52 +0530 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2019-07-12 10:56:27 -0400 |
commit | f37f47126236c8dc710d97da8ca9d43c38bef4ec (patch) | |
tree | e2e2af7cb30ef128f0b15bbbf3bc74bce1a6da2e /hw/virtio/virtio-pmem-pci.c | |
parent | 7b9829bc6c7d84056c3a1c60737f71db4d2871e4 (diff) |
virtio pmem: fix wrong mem region condition
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>
Diffstat (limited to 'hw/virtio/virtio-pmem-pci.c')
-rw-r--r-- | hw/virtio/virtio-pmem-pci.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/virtio/virtio-pmem-pci.c b/hw/virtio/virtio-pmem-pci.c index 8b2d0dbccc..0da6627469 100644 --- a/hw/virtio/virtio-pmem-pci.c +++ b/hw/virtio/virtio-pmem-pci.c @@ -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, |