fix coverity bugs
cover fix coverity bugs
Hi all.
Here are two bug fixes, thanks to Peter for reporting.
Both are introduced in 2.12.
Vladimir Sementsov-Ogievskiy (2):
nbd/client: fix nbd_negotiate_simple_meta_context migration/block-dirty-bitmap: fix memory leak in
dirty_bitmap_load_bits
migration/block-dirty-bitmap.c | 1 + nbd/client.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.11.1
PATCH 1/2 nbd/client: fix nbd_negotiate_simple_meta_context
Initialize received variable. Otherwise, is is possible for server to answer without any contexts, but we will set context_id to something random (received_id is not initialized too) and return 1, which is wrong.
To solve it, just initialize received to false. Initialize received_id too, just to make all possible checkers happy.
But was introduced in 78a33ab58782efdb206de14 "nbd: BLOCK_STATUS for standard get_block_status function: client part" with the whole function.
--- nbd/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
nbd/client.c +2 -2
@@ -613,8 +613,8 @@ static int nbd_negotiate_simple_meta_context(QIOChannel *ioc, {int ret;NBDOptionReply reply; -uint32_t received_id; -bool received; +uint32_t received_id =0 ; +bool received = false;uint32_t export_len =strlen (export);uint32_t context_len =strlen (context); uint32_t data_len = sizeof(export_len) + export_len +
Signature · 1 line
2.11.1
Re: [Qemu-devel] [PATCH 1/2] nbd/client: fix nbd_negotiate_simple_meta_context
Quoted 9 lines · Vladimir Sementsov-Ogievskiy
Initialize received variable. Otherwise, is is possible for server to answer without any contexts, but we will set
context_idto something random (received_idis not initialized too) and return 1, which is wrong.To solve it, just initialize received to false. Initialize
received_idtoo, just to make all possible checkers happy.But was introduced in
78a33ab58782efdb206de14"nbd:BLOCK_STATUSfor
s/But/Bug/
Quoted 7 lines
standard
get_block_statusfunction: client part" with the whole function.Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- nbd/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
PATCH 2/2 migration/block-dirty-bitmap: fix memory leak in dirty_bitmap_load_bits
In reply to Vladimir Sementsov-OgievskiyRelease buf on error path too.
Bug was introduced in b35ebdf076d697bc "migration: add postcopy migration of dirty bitmaps" with the whole function.
--- migration/block-dirty-bitmap.c | 1 + 1 file changed, 1 insertion(+)
migration/block-dirty-bitmap.c +1 -0
@@ -600,6 +600,7 @@ static int dirty_bitmap_load_bits(QEMUFile *f, DirtyBitmapLoadState *s) ret =qemu_get_buffer (f, buf, buf_size);if (ret != buf_size) {error_report ("Failed to read bitmap bits" ); +g_free (buf);return -EIO ; }
Signature · 1 line
2.11.1
Quoted 10 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Here are two bug fixes, thanks to Peter for reporting.
Both are introduced in 2.12.
Vladimir Sementsov-Ogievskiy (2):
nbd/client: fixnbd_negotiate_simple_meta_contextmigration/block-dirty-bitmap: fix memory leak in
dirty_bitmap_load_bits
Adding both to my NBD queue
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org