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