]> Git Repo - qemu.git/commitdiff
vfio: fix return type of pread
authorPaolo Bonzini <[email protected]>
Mon, 6 Jul 2015 18:15:12 +0000 (12:15 -0600)
committerAlex Williamson <[email protected]>
Mon, 6 Jul 2015 18:15:12 +0000 (12:15 -0600)
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 <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
hw/vfio/pci.c

index e0e339a534a1e91483aabb0d0ff78d78734f46c3..b8fa4ac509aa8f63f7eaa5408e2ce0ce2d2c7d4d 100644 (file)
@@ -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");
This page took 0.030513 seconds and 4 git commands to generate.