From: Pankaj Gupta Date: Fri, 12 Jul 2019 07:35:52 +0000 (+0530) Subject: virtio pmem: fix wrong mem region condition X-Git-Tag: v4.1.0-rc1~11^2~2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f37f47126236c8dc710d97da8ca9d43c38bef4ec;p=users%2Fdwmw2%2Fqemu.git 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 Message-Id: <20190712073554.21918-2-pagupta@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Reviewed-by: Cornelia Huck --- 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,