thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From d7a6dbe86fbbb30cc8142deb71763089aa1f2b62 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri, 18 Oct 2013 08:14:49 +0200
Subject: [PATCH 24/81] block/get_block_status: set *pnum = 0 on error

RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <1382084091-16636-25-git-send-email-pbonzini@redhat.com>
Patchwork-id: 55007
O-Subject: [RHEL 7.0 qemu-kvm PATCH 24/26] block/get_block_status: set *pnum = 0 on error
Bugzilla: 989646
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

From: Peter Lieven <pl@kamp.de>

if the call is invoked through bdrv_is_allocated the caller might
expect *pnum = 0 on error. however, a new implementation of
bdrv_get_block_status might only return a negative exit value on
error while keeping *pnum untouched.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 3e0a233d869e74e78b516be34715b91528508cfc)
---
 block.c | 1 +
 1 file changed, 1 insertion(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index f993b2e..02e111e 100644
--- a/block.c
+++ b/block.c
@@ -3069,6 +3069,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
 
     ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
     if (ret < 0) {
+        *pnum = 0;
         return ret;
     }
 
-- 
1.7.1