From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Stefan Hajnoczi <stefanha@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [PULL 1/2] util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended
Date: Thu, 26 Sep 2019 10:54:50 +0000 [thread overview]
Message-ID: <b67c1d0e-772b-e3a7-a3cc-29fbf070347a@virtuozzo.com> (raw)
In-Reply-To: <20190925174400.8578-2-stefanha@redhat.com>
25.09.2019 20:43, Stefan Hajnoczi wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> 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
> difference.
>
> Reported-by: Coverity (CID 1405302)
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Message-id: 20190910090310.14032-1-vsementsov@virtuozzo.com
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Message-Id: <20190910090310.14032-1-vsementsov@virtuozzo.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> util/iov.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/util/iov.c b/util/iov.c
> index 5059e10431..a4689ff3c9 100644
> --- a/util/iov.c
> +++ b/util/iov.c
> @@ -446,7 +446,8 @@ void qemu_iovec_init_extended(
> p++;
> }
>
> - 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;
>
Hmm, seems we have to squash in:
--- a/util/iov.c
+++ b/util/iov.c
@@ -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,
--
Best regards,
Vladimir
next prev parent reply other threads:[~2019-09-26 10:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 17:43 [PULL 0/2] Block patches Stefan Hajnoczi
2019-09-25 17:43 ` [PULL 1/2] util/ioc.c: try to reassure Coverity about qemu_iovec_init_extended Stefan Hajnoczi
2019-09-26 10:54 ` Vladimir Sementsov-Ogievskiy [this message]
2019-09-25 17:44 ` [PULL 2/2] virtio-blk: schedule virtio_notify_config to run on main context Stefan Hajnoczi
2019-09-26 6:16 ` [PULL 0/2] Block patches no-reply
2019-09-26 12:06 ` Vladimir Sementsov-Ogievskiy
2019-09-26 12:56 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b67c1d0e-772b-e3a7-a3cc-29fbf070347a@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).