From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtB73-0001gk-Er for qemu-devel@nongnu.org; Fri, 15 May 2015 04:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtB6z-0001Lc-B7 for qemu-devel@nongnu.org; Fri, 15 May 2015 04:36:57 -0400 From: Fam Zheng Date: Fri, 15 May 2015 16:36:04 +0800 Message-Id: <1431678966-16470-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2 0/2] block: Fix error code for bdrv_getlength when the image is too big List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , berto@igalia.com, armbru@redhat.com, qemu-block@nongnu.org v2: Correct detection of overflow. [Markus, Berto] If the image has a huge enough virtual size, $ qemu-img info afl9.img qemu-img: Can't get size of device 'image': Unknown error -512 It's because of the multiplication overflow in the return statement in bdrv_getlength (the big nagetive value is later truncated to 0x200). Fix it to return -EFBIG: qemu-img: Can't get size of device 'image': File too large Bug reported by Richard Jones in: https://bugzilla.redhat.com/show_bug.cgi?id=1221499 Fam Zheng (2): block: Detect multiplication overflow in bdrv_getlength qemu-iotests: qemu-img info on afl VMDK image with a huge capacity block.c | 1 + tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 3 +++ tests/qemu-iotests/sample_images/afl9.vmdk.bz2 | Bin 0 -> 178 bytes 4 files changed, 9 insertions(+) create mode 100644 tests/qemu-iotests/sample_images/afl9.vmdk.bz2 -- 2.4.0