Commit d38d6de2 authored by Vladimir Sementsov-Ogievskiy's avatar Vladimir Sementsov-Ogievskiy Committed by Stefan Hajnoczi

util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended

Make it more obvious, that filling qiov corresponds to qiov allocation,
which in turn corresponds to total_niov calculation, based on mid_niov
(not mid_len). Still add an assertion to show that there should be no

[Added mingw "error: 'mid_iov' may be used uninitialized in this
function" compiler error fix suggested by Vladimir.

Reported-by: Coverity (CID 1405302)
Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <>
Suggested-by: default avatarPeter Maydell <>
Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <>
Message-Id: <>
Signed-off-by: default avatarStefan Hajnoczi <>

fixup! util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended
parent 560009f2
......@@ -423,7 +423,7 @@ void qemu_iovec_init_extended(
size_t mid_head, mid_tail;
int total_niov, mid_niov = 0;
struct iovec *p, *mid_iov;
struct iovec *p, *mid_iov = NULL;
if (mid_len) {
mid_iov = qiov_slice(mid_qiov, mid_offset, mid_len,
......@@ -446,7 +446,8 @@ void qemu_iovec_init_extended(
if (mid_len) {
assert(!mid_niov == !mid_len);
if (mid_niov) {
memcpy(p, mid_iov, mid_niov * sizeof(*p));
p[0].iov_base = (uint8_t *)p[0].iov_base + mid_head;
p[0].iov_len -= mid_head;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment