aboutsummaryrefslogtreecommitdiff
path: root/block-qcow2.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-24 16:52:15 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-09-24 16:52:15 +0000
commitf4af02ed1bb688ffd8a944b878c6b57b508dbc03 (patch)
treed1f80ea8e2dda8a5c1c52f6a29c06b46d808ae43 /block-qcow2.c
parent234c9bcd7ac8178da88a74e5f35474dccdf7141f (diff)
downloadqemu-f4af02ed1bb688ffd8a944b878c6b57b508dbc03.zip
qemu-f4af02ed1bb688ffd8a944b878c6b57b508dbc03.tar.gz
qemu-f4af02ed1bb688ffd8a944b878c6b57b508dbc03.tar.bz2
fix bug in block-qcow2.c:alloc_cluster_offset() (Shahar Frank)
During the debugging of the new revision of the zero dedup patch I stepped on the following bug in block-qcow2.c:alloc_cluster_offset(). I am not sure what the exact damage this bug can do, but it may be very nasty because you way not notice it effects until you will do some snapshot operations or similar actions that rely on the reference counting. The bug is easy to spot using the new "check" verb I added to the qemu-img in one of the previous patches. I will resend the qemu-img patch again with the new version of the zero dedup. Signed-off-by: Shahar Frank <shaharf@qumranet.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5313 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-qcow2.c')
-rw-r--r--block-qcow2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block-qcow2.c b/block-qcow2.c
index 5f0fbe8..693cd77 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -917,7 +917,7 @@ static uint64_t alloc_cluster_offset(BlockDriverState *bs,
/* how many free clusters ? */
while (i < nb_clusters) {
- cluster_offset = l2_table[l2_index + i];
+ cluster_offset = be64_to_cpu(l2_table[l2_index + i]);
if (cluster_offset != 0)
break;
i++;