Skip to content

Commit

Permalink
virtio pmem: fix wrong mem region condition
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pankaj Gupta authored and mstsirkin committed Jul 12, 2019
1 parent 7b9829b commit f37f471
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/virtio/virtio-pmem-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f37f471

Please sign in to comment.