From b3224f122a52865434a59972b40d5dae88230df1 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <66e362d96df8c5d8d9170ae4c871047c4c23acfc.1334848702.git.minovotn@redhat.com> References: <66e362d96df8c5d8d9170ae4c871047c4c23acfc.1334848702.git.minovotn@redhat.com> From: Kevin Wolf Date: Thu, 19 Apr 2012 10:29:10 +0200 Subject: [PATCH 2/2] qcow2: Fix return value of alloc_refcount_block RH-Author: Kevin Wolf Message-id: <1334831350-5491-1-git-send-email-kwolf@redhat.com> Patchwork-id: 39345 O-Subject: [RHEL-6.3 qemu-kvm PATCH] qcow2: Fix return value of alloc_refcount_block Bugzilla: 812833 RH-Acked-by: Paolo Bonzini RH-Acked-by: Jeffrey Cody RH-Acked-by: Luiz Capitulino Bugzilla: 812833 Upstream status: Submitted 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 --- block/qcow2-refcount.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- block/qcow2-refcount.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index b79736e..74e1d49 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); -- 1.7.7.6