From patchwork Tue Sep 24 11:50:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 277466 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4E2A72C00BB for ; Tue, 24 Sep 2013 21:51:26 +1000 (EST) Received: from localhost ([::1]:45018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOR9H-0000dt-IF for incoming@patchwork.ozlabs.org; Tue, 24 Sep 2013 07:51:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOR8q-0000WN-FS for qemu-devel@nongnu.org; Tue, 24 Sep 2013 07:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOR8k-0003K5-At for qemu-devel@nongnu.org; Tue, 24 Sep 2013 07:50:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOR8k-0003Jw-1j for qemu-devel@nongnu.org; Tue, 24 Sep 2013 07:50:50 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8OBomOu032104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 Sep 2013 07:50:48 -0400 Received: from localhost (dhcp-200-247.str.redhat.com [10.33.200.247]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8OBol5l001654 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 24 Sep 2013 07:50:48 -0400 From: Max Reitz To: qemu-devel@nongnu.org Date: Tue, 24 Sep 2013 13:50:46 +0200 Message-Id: <1380023446-18176-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH] qcow2: Don't shadow return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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). Signed-off-by: Max Reitz --- block/qcow2-refcount.c | 1 - 1 file changed, 1 deletion(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 4264148..d2b7064 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -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,