Received: from eggs.gnu.org ([2001:4830:134:3::10]:40139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7jZO-00010T-KQ for qemu-devel@nongnu.org; Wed, 24 Jun 2015 08:14:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7jZK-0000Am-G8 for qemu-devel@nongnu.org; Wed, 24 Jun 2015 08:14:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7jZK-0000Af-Ak for qemu-devel@nongnu.org; Wed, 24 Jun 2015 08:14:18 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id DDCEA8F287 for ; Wed, 24 Jun 2015 12:14:17 +0000 (UTC) From: Paolo Bonzini Date: Wed, 24 Jun 2015 14:14:15 +0200 Message-Id: <1435148055-2700-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH] vfio: fix return type of pread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: alex.williamson@redhat.com 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 --- hw/vfio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, ®_info)) { error_report("vfio: Error getting ROM info: %m"); -- 2.4.3