From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn52E-0005nN-5k for qemu-devel@nongnu.org; Tue, 28 Apr 2015 08:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yn529-0001kE-7A for qemu-devel@nongnu.org; Tue, 28 Apr 2015 08:54:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yn528-0001k8-WB for qemu-devel@nongnu.org; Tue, 28 Apr 2015 08:54:41 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3SCsdUm029170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 28 Apr 2015 08:54:39 -0400 Date: Tue, 28 Apr 2015 14:54:37 +0200 From: Kevin Wolf Message-ID: <20150428125437.GB4378@noname.redhat.com> References: <1430144581-9803-1-git-send-email-famz@redhat.com> <553E6CE2.6050502@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <553E6CE2.6050502@redhat.com> Subject: Re: [Qemu-devel] [PATCH] vmdk: Widen before shifting 32 bit header field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: Fam Zheng , qemu-devel@nongnu.org, Stefan Hajnoczi , armbru@redhat.com Am 27.04.2015 um 19:07 hat John Snow geschrieben: > > > On 04/27/2015 10:23 AM, Fam Zheng wrote: > >Coverity spotted this. > > > >The field is 32 bits, but if it's possible to overflow in 32 bit > >left shift. > > > >Signed-off-by: Fam Zheng > >--- > > block/vmdk.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/block/vmdk.c b/block/vmdk.c > >index 8410a15..d72a6e8 100644 > >--- a/block/vmdk.c > >+++ b/block/vmdk.c > >@@ -523,7 +523,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs, > > } > > ret = vmdk_add_extent(bs, file, false, > > le32_to_cpu(header.disk_sectors), > >- le32_to_cpu(header.l1dir_offset) << 9, > >+ (int64_t)le32_to_cpu(header.l1dir_offset) << 9, > > 0, > > le32_to_cpu(header.l1dir_size), > > 4096, > > > > Reviewed-by: John Snow Thanks, applied to the block branch. Kevin