|
|
357786 |
From 71b082ce48653cb70bf628f753d6e7750f8d03c2 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Date: Wed, 18 Jul 2018 22:55:07 +0200
|
|
|
357786 |
Subject: [PATCH 82/89] nbd/server: Silence gcc false positive
|
|
|
357786 |
|
|
|
357786 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Message-id: <20180718225511.14878-32-jsnow@redhat.com>
|
|
|
357786 |
Patchwork-id: 81425
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 31/35] nbd/server: Silence gcc false positive
|
|
|
357786 |
Bugzilla: 1207657
|
|
|
357786 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
357786 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
From: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
The code has a while() loop that always initialized 'end', and
|
|
|
357786 |
the loop always executes at least once (as evidenced by the assert()
|
|
|
357786 |
just prior to the loop). But some versions of gcc still complain
|
|
|
357786 |
that 'end' is used uninitialized, so silence them.
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
357786 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
357786 |
Message-id: 20180622125814.345274-1-eblake@redhat.com
|
|
|
357786 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
357786 |
(cherry picked from commit 45eb6fb6cea28cdc937764aac6585751047bb294)
|
|
|
357786 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
nbd/server.c | 3 ++-
|
|
|
357786 |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/nbd/server.c b/nbd/server.c
|
|
|
357786 |
index 2746046..50ac8bf 100644
|
|
|
357786 |
--- a/nbd/server.c
|
|
|
357786 |
+++ b/nbd/server.c
|
|
|
357786 |
@@ -1937,7 +1937,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
|
|
|
357786 |
unsigned int nb_extents,
|
|
|
357786 |
bool dont_fragment)
|
|
|
357786 |
{
|
|
|
357786 |
- uint64_t begin = offset, end;
|
|
|
357786 |
+ uint64_t begin = offset, end = offset;
|
|
|
357786 |
uint64_t overall_end = offset + *length;
|
|
|
357786 |
unsigned int i = 0;
|
|
|
357786 |
BdrvDirtyBitmapIter *it;
|
|
|
357786 |
@@ -1977,6 +1977,7 @@ static unsigned int bitmap_to_extents(BdrvDirtyBitmap *bitmap, uint64_t offset,
|
|
|
357786 |
|
|
|
357786 |
bdrv_dirty_bitmap_unlock(bitmap);
|
|
|
357786 |
|
|
|
357786 |
+ assert(offset > end);
|
|
|
357786 |
*length = end - offset;
|
|
|
357786 |
return i;
|
|
|
357786 |
}
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|