util/iov: make qemu_iovec_init_extended() honest
commit4c002cef0e9abe7135d7916c51abce47f7fc1ee2
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Fri, 11 Dec 2020 18:39:20 +0000 (11 21:39 +0300)
committerEric Blake <eblake@redhat.com>
Wed, 3 Feb 2021 14:00:33 +0000 (3 08:00 -0600)
treecd2bfc6b897f859e5c26f9c3b761c540a20f97cf
parent69b55e03f7e65a36eb954d0b7d4698b258df2708
util/iov: make qemu_iovec_init_extended() honest

Actually, we can't extend the io vector in all cases. Handle possible
MAX_IOV and size_t overflows.

For now add assertion to callers (actually they rely on success anyway)
and fix them in the following patch.

Add also some additional good assertions to qemu_iovec_init_slice()
while being here.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20201211183934.169161-3-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
block/io.c
include/qemu/iov.h
util/iov.c