qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Ilya Maximets <i.maximets@ovn.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH] memory: initialize 'fv' in MemoryRegionCache to make Coverity happy
Date: Wed, 11 Oct 2023 16:59:51 -0400	[thread overview]
Message-ID: <CAJSP0QULQ3EGuypp0M_MSRR7fMeifaCxhqUBwzcPQuKeKYMacQ@mail.gmail.com> (raw)
In-Reply-To: <20231009104322.3085887-1-i.maximets@ovn.org>

On Mon, 9 Oct 2023 at 06:44, Ilya Maximets <i.maximets@ovn.org> wrote:
>
> Coverity scan reports multiple false-positive "defects" for the
> following series of actions in virtio.c:
>
>   MemoryRegionCache indirect_desc_cache;
>   address_space_cache_init_empty(&indirect_desc_cache);
>   address_space_cache_destroy(&indirect_desc_cache);
>
> For some reason it's unable to recognize the dependency between 'mrs.mr'
> and 'fv' and insists that '!mrs.mr' check in address_space_cache_destroy
> may take a 'false' branch, even though it is explicitly initialized to
> NULL in the address_space_cache_init_empty():
>
>   *** CID 1522371:  Memory - illegal accesses  (UNINIT)
>   /qemu/hw/virtio/virtio.c: 1627 in virtqueue_split_pop()
>   1621         }
>   1622
>   1623         vq->inuse++;
>   1624
>   1625         trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num);
>   1626     done:
>   >>>     CID 1522371:  Memory - illegal accesses  (UNINIT)
>   >>>     Using uninitialized value "indirect_desc_cache.fv" when
>   >>>     calling "address_space_cache_destroy".
>   1627         address_space_cache_destroy(&indirect_desc_cache);
>   1628
>   1629         return elem;
>   1630
>   1631     err_undo_map:
>   1632         virtqueue_undo_map_desc(out_num, in_num, iov);
>
>   ** CID 1522370:  Memory - illegal accesses  (UNINIT)
>
> Instead of trying to silence these false positive reports in 4
> different places, initializing 'fv' as well, as this doesn't result
> in any noticeable performance impact.
>
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---
>  include/exec/memory.h | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>


      parent reply	other threads:[~2023-10-11 21:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 10:43 [PATCH] memory: initialize 'fv' in MemoryRegionCache to make Coverity happy Ilya Maximets
2023-10-09 12:06 ` David Hildenbrand
2023-10-11 20:59 ` Stefan Hajnoczi [this message]

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=CAJSP0QULQ3EGuypp0M_MSRR7fMeifaCxhqUBwzcPQuKeKYMacQ@mail.gmail.com \
    --to=stefanha@gmail.com \
    --cc=david@redhat.com \
    --cc=i.maximets@ovn.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.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).