aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2-refcount.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-04-18 16:27:06 +0200
committerKevin Wolf <kwolf@redhat.com>2012-04-19 16:03:27 +0200
commit2795ecf681107d55e4113592b3045ece5f6e7b3b (patch)
treef53c6b731c6d27fa823719c84c1ddd59fbc6642f /block/qcow2-refcount.c
parent8dc0a5e7a06c059683f9c379c0a4b0bbc20d5c74 (diff)
downloadqemu-2795ecf681107d55e4113592b3045ece5f6e7b3b.zip
qemu-2795ecf681107d55e4113592b3045ece5f6e7b3b.tar.gz
qemu-2795ecf681107d55e4113592b3045ece5f6e7b3b.tar.bz2
qcow2: Fix return value of alloc_refcount_block
Someone forgot something in commit 29c1a730... Documenting the right return value is not enough, you also need to actually return it in the code. This bug sometimes causes error return values even when everything has succeeded: The new offset of the refcount block is truncated to 32 bits and interpreted as signed. At least with small cluster sizes it's easy to get a negative return value this way. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block/qcow2-refcount.c')
-rw-r--r--block/qcow2-refcount.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index f39928a..565bd54 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -400,7 +400,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
return ret;
}
- return new_block;
+ return 0;
fail_table:
g_free(new_table);