9ae3a8
From d7a6dbe86fbbb30cc8142deb71763089aa1f2b62 Mon Sep 17 00:00:00 2001
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Date: Fri, 18 Oct 2013 08:14:49 +0200
9ae3a8
Subject: [PATCH 24/81] block/get_block_status: set *pnum = 0 on error
9ae3a8
9ae3a8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Message-id: <1382084091-16636-25-git-send-email-pbonzini@redhat.com>
9ae3a8
Patchwork-id: 55007
9ae3a8
O-Subject: [RHEL 7.0 qemu-kvm PATCH 24/26] block/get_block_status: set *pnum = 0 on error
9ae3a8
Bugzilla: 989646
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
9ae3a8
From: Peter Lieven <pl@kamp.de>
9ae3a8
9ae3a8
if the call is invoked through bdrv_is_allocated the caller might
9ae3a8
expect *pnum = 0 on error. however, a new implementation of
9ae3a8
bdrv_get_block_status might only return a negative exit value on
9ae3a8
error while keeping *pnum untouched.
9ae3a8
9ae3a8
Reviewed-by: Eric Blake <eblake@redhat.com>
9ae3a8
Signed-off-by: Peter Lieven <pl@kamp.de>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 3e0a233d869e74e78b516be34715b91528508cfc)
9ae3a8
---
9ae3a8
 block.c | 1 +
9ae3a8
 1 file changed, 1 insertion(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block.c |    1 +
9ae3a8
 1 files changed, 1 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index f993b2e..02e111e 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -3069,6 +3069,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
9ae3a8
 
9ae3a8
     ret = bs->drv->bdrv_co_get_block_status(bs, sector_num, nb_sectors, pnum);
9ae3a8
     if (ret < 0) {
9ae3a8
+        *pnum = 0;
9ae3a8
         return ret;
9ae3a8
     }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8