Skip to contentSkip to conversation

qcow2: Don't shadow return value

PATCH Applied Max Reitz 2 participants 2 messages Sep 24, 2013 Block layer

lore
Share & tools
lore

Max Reitz

author
#0 lore raw

PATCH 1/1 qcow2: Don't shadow return value

When trying to update the refcounts for a snapshot, the return value of update_refcount on a compressed cluster was pretty much ignored, cancelling the update on error but returning 0. This is caused by an inner "ret" variable shadowing the outer one (the latter is used in the return statement).

---
 block/qcow2-refcount.c | 1 -
 1 file changed, 1 deletion(-)
block/qcow2-refcount.c +0 -1
index 4264148..d2b7064 100644
@@ -874,7 +874,6 @@ int qcow2_update_snapshot_refcount(BlockDriverState *bs,
                         nb_csectors = ((offset >> s->csize_shift) &
                                        s->csize_mask) + 1;
                         if (addend != 0) {
-                            int ret;
                             ret = update_refcount(bs,
                                 (offset & s->cluster_offset_mask) & ~511,
                                 nb_csectors * 512, addend,
Signature · 1 line
1.8.3.1
Applied
#1 lore raw

Am 24.09.2013 um 13:50 hat Max Reitz geschrieben:

Quoted 7 lines

When trying to update the refcounts for a snapshot, the return value of update_refcount on a compressed cluster was pretty much ignored, cancelling the update on error but returning 0. This is caused by an inner "ret" variable shadowing the outer one (the latter is used in the return statement).

Thanks, applied to the block branch.

Kevin