cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Fix-compiler-warning-Werror-uninitialized.patch

218e99
From b888e19c99ff56e39a1e7364d66077a4dbfa512b Mon Sep 17 00:00:00 2001
218e99
From: Paolo Bonzini <pbonzini@redhat.com>
218e99
Date: Fri, 18 Oct 2013 08:14:34 +0200
218e99
Subject: [PATCH 09/81] block: Fix compiler warning (-Werror=uninitialized)
218e99
MIME-Version: 1.0
218e99
Content-Type: text/plain; charset=UTF-8
218e99
Content-Transfer-Encoding: 8bit
218e99
218e99
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
218e99
Message-id: <1382084091-16636-10-git-send-email-pbonzini@redhat.com>
218e99
Patchwork-id: 54991
218e99
O-Subject: [RHEL 7.0 qemu-kvm PATCH 09/26] block: Fix compiler warning (-Werror=uninitialized)
218e99
Bugzilla: 989646
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Max Reitz <mreitz@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
218e99
From: Stefan Weil <sw@weilnetz.de>
218e99
218e99
The patch fixes a warning from gcc (Debian 4.6.3-14+rpi1) 4.6.3:
218e99
218e99
block/stream.c:141:22: error:
218e99
‘copy’ may be used uninitialized in this function [-Werror=uninitialized]
218e99
218e99
This is not a real bug - a better compiler would not complain.
218e99
218e99
Now 'copy' has always a defined value, so the check for ret >= 0
218e99
can be removed.
218e99
218e99
Signed-off-by: Stefan Weil <sw@weilnetz.de>
218e99
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit c3e4f43a99549daa6e9b87350922e8339341c2ab)
218e99
---
218e99
 block/stream.c | 5 +++--
218e99
 1 file changed, 3 insertions(+), 2 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block/stream.c |    5 +++--
218e99
 1 files changed, 3 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/block/stream.c b/block/stream.c
218e99
index 995b97b..276487c 100644
218e99
--- a/block/stream.c
218e99
+++ b/block/stream.c
218e99
@@ -115,11 +115,12 @@ wait:
218e99
             break;
218e99
         }
218e99
 
218e99
+        copy = false;
218e99
+
218e99
         ret = bdrv_is_allocated(bs, sector_num,
218e99
                                 STREAM_BUFFER_SIZE / BDRV_SECTOR_SIZE, &n);
218e99
         if (ret == 1) {
218e99
             /* Allocated in the top, no need to copy.  */
218e99
-            copy = false;
218e99
         } else if (ret >= 0) {
218e99
             /* Copy if allocated in the intermediate images.  Limit to the
218e99
              * known-unallocated area [sector_num, sector_num+n).  */
218e99
@@ -134,7 +135,7 @@ wait:
218e99
             copy = (ret == 1);
218e99
         }
218e99
         trace_stream_one_iteration(s, sector_num, n, ret);
218e99
-        if (ret >= 0 && copy) {
218e99
+        if (copy) {
218e99
             if (s->common.speed) {
218e99
                 delay_ns = ratelimit_calculate_delay(&s->limit, n);
218e99
                 if (delay_ns > 0) {
218e99
-- 
218e99
1.7.1
218e99