From: Paolo Bonzini Date: Mon, 6 Jul 2015 18:15:12 +0000 (-0600) Subject: vfio: fix return type of pread X-Git-Tag: v2.4.0-rc0~18^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d489dcdf5fd71b5052ffd401b869a627e1c751f;p=thirdparty%2Fqemu.git 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 Signed-off-by: Alex Williamson --- diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index e0e339a534a..b8fa4ac509a 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, ®_info)) { error_report("vfio: Error getting ROM info: %m");