aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-07-06 12:15:12 -0600
committerAlex Williamson <alex.williamson@redhat.com>2015-07-06 12:15:12 -0600
commit7d489dcdf5fd71b5052ffd401b869a627e1c751f (patch)
tree3d0055bb15ffd5a0287fa0cb73d3c0a0c0af3a2e /hw/vfio
parent7edd8e4660beb301d527257f8e04ebec0f841cb0 (diff)
downloadqemu-7d489dcdf5fd71b5052ffd401b869a627e1c751f.zip
qemu-7d489dcdf5fd71b5052ffd401b869a627e1c751f.tar.gz
qemu-7d489dcdf5fd71b5052ffd401b869a627e1c751f.tar.bz2
vfio: fix return type of pread
size_t is an unsigned type, thus the error case is never reached in the below call to pread. If bytes is negative, it will be seen as a very high positive value. Spotted by Coverity. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r--hw/vfio/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index e0e339a..b8fa4ac 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -939,7 +939,7 @@ static void vfio_pci_load_rom(VFIOPCIDevice *vdev)
};
uint64_t size;
off_t off = 0;
- size_t bytes;
+ ssize_t bytes;
if (ioctl(vdev->vbasedev.fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info)) {
error_report("vfio: Error getting ROM info: %m");