From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccDuy-0001q6-Vu for qemu-devel@nongnu.org; Fri, 10 Feb 2017 11:19:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccDux-0001Ft-R3 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 11:19:29 -0500 Date: Fri, 10 Feb 2017 16:19:14 +0000 From: "Daniel P. Berrange" Message-ID: <20170210161914.GD12176@redhat.com> Reply-To: "Daniel P. Berrange" References: <20170126101827.22378-1-berrange@redhat.com> <20170126101827.22378-9-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v3 08/18] qcow: make encrypt_sectors encrypt in place List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-devel@nongnu.org, Kevin Wolf , qemu-block@nongnu.org, Max Reitz On Fri, Feb 10, 2017 at 11:44:15AM +0100, Alberto Garcia wrote: > On Thu 26 Jan 2017 11:18:17 AM CET, Daniel P. Berrange wrote: > > Instead of requiring separate input/output buffers for > > encrypting data, change encrypt_sectors() to assume > > use of a single buffer, encrypting in place. One current > > caller uses the same buffer for input/output already > > and the other two callers are easily converted to do so. > > > > Signed-off-by: Daniel P. Berrange > > Reviewed-by: Alberto Garcia > > > @@ -469,13 +465,12 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, > > uint64_t start_sect; > > assert(s->cipher); > > start_sect = (offset & ~(s->cluster_size - 1)) >> 9; > > - memset(s->cluster_data + 512, 0x00, 512); > > I haven't checked this thoroughly, but without this patch it seems that > this would overflow if the cluster size is 512 bytes (the minimum > allowed by qcow). Heh, yeah, I think you are right :-) Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|