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 <berra...@redhat.com> > > Reviewed-by: Alberto Garcia <be...@igalia.com> > > > @@ -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/ :|