qcow2: Fix return value of alloc_refcount_block
authorKevin Wolf <kwolf@redhat.com>
Wed, 18 Apr 2012 14:27:06 +0000 (16:27 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 19 Apr 2012 14:03:27 +0000 (16:03 +0200)
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>
block/qcow2-refcount.c

index f39928a6bf0a563dc9fffbb2262f59d032c1e3be..565bd549026488b6d2800659cf09841ff9e8a8b3 100644 (file)
@@ -400,7 +400,7 @@ static int alloc_refcount_block(BlockDriverState *bs,
         return ret;
     }
 
-    return new_block;
+    return 0;
 
 fail_table:
     g_free(new_table);