diff options
author | Eric Blake | 2020-11-06 21:36:11 +0100 |
---|---|---|
committer | Eric Blake | 2020-11-16 21:51:12 +0100 |
commit | c0b21f2e221e5edafb400e8acfa04db3ad5bf956 (patch) | |
tree | 2bd553dc90ecbe23a1b188388b3c39ef1bc11764 /nbd | |
parent | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-11-1... (diff) | |
download | qemu-c0b21f2e221e5edafb400e8acfa04db3ad5bf956.tar.gz qemu-c0b21f2e221e5edafb400e8acfa04db3ad5bf956.tar.xz qemu-c0b21f2e221e5edafb400e8acfa04db3ad5bf956.zip |
nbd: Silence Coverity false positive
Coverity noticed (CID 1436125) that we check the return value of
nbd_extent_array_add in most places, but not at the end of
bitmap_to_extents(). The return value exists to break loops before a
future iteration, so there is nothing to check if we are already done
iterating. Adding a cast to void, plus a comment why, pacifies
Coverity.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20201111163510.713855-1-eblake@redhat.com>
[eblake: Prefer cast to void over odd && usage]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'nbd')
-rw-r--r-- | nbd/server.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nbd/server.c b/nbd/server.c index d145e1a690..613ed2634a 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -2129,8 +2129,8 @@ static void bitmap_to_extents(BdrvDirtyBitmap *bitmap, } if (!full) { - /* last non dirty extent */ - nbd_extent_array_add(es, end - start, 0); + /* last non dirty extent, nothing to do if array is now full */ + (void) nbd_extent_array_add(es, end - start, 0); } bdrv_dirty_bitmap_unlock(bitmap); |