]> git.proxmox.com Git - mirror_qemu.git/blobdiff - block/qcow2-cluster.c
qcow2: fix encryption during cow of sectors
[mirror_qemu.git] / block / qcow2-cluster.c
index 9ab445dd1722263adb2f43a36098075441e241dc..61d1ffd2235f8bc9dbd1e02ac3563473f4e190aa 100644 (file)
@@ -429,7 +429,7 @@ static int coroutine_fn do_perform_cow(BlockDriverState *bs,
 
     if (bs->encrypted) {
         Error *err = NULL;
-        int64_t sector = (cluster_offset + offset_in_cluster)
+        int64_t sector = (src_cluster_offset + offset_in_cluster)
                          >> BDRV_SECTOR_BITS;
         assert(s->cipher);
         assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0);