From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Can we make better use of Coverity?
Date: Wed, 21 Jan 2015 17:22:36 +0100 [thread overview]
Message-ID: <54BFD24C.90400@redhat.com> (raw)
In-Reply-To: <87r3uo9l1i.fsf@blackfin.pond.sub.org>
On 21/01/2015 17:05, Markus Armbruster wrote:
>>> >> What do you mean by "a GLib model"? scripts/coverity-model.c?
>> >
>> > Yes. It models g_malloc0 in a way that avoids a lot of false positives,
>> > but still is able to flag leaks.
> Understood. It's hugely better than nothing,
Yes, I think between false positives and false negatives it affected
over 100 defects.
> but it still can't make
> Coverity see many relevant facts like GLib functions returning newly
> allocated storage. For that, you have to throw in a derived model, like
> I do. Unfortunately, the Scan service seems unable to do that.
Right. You can also model the functions manually, like we do for
g_io_channel_unix_new:
typedef struct _GIOChannel GIOChannel;
GIOChannel *g_io_channel_unix_new(int fd)
{
GIOChannel *c = g_malloc0(sizeof(GIOChannel));
__coverity_escape__(fd);
return c;
}
(This was done because of false positives when Coverity thought that fd
would leak at end of scope).
If you know some offenders which did cause us to leak memory in the
past, please do submit a patch to scripts/coverity-model.c.
BTW, thanks for starting this thread. We already have like 6 new users
who will be able to see the defects and fix them! That alone is very
much worthy!
Paolo
next prev parent reply other threads:[~2015-01-21 16:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-21 12:47 [Qemu-devel] Can we make better use of Coverity? Markus Armbruster
2015-01-21 12:57 ` Peter Maydell
2015-01-21 13:58 ` Markus Armbruster
2015-01-21 16:03 ` Paolo Bonzini
2015-01-21 16:50 ` Markus Armbruster
2015-01-21 13:31 ` Daniel P. Berrange
2015-01-21 15:55 ` Markus Armbruster
2015-01-21 15:59 ` Peter Maydell
2015-01-21 16:11 ` Paolo Bonzini
2015-01-21 14:19 ` Paolo Bonzini
2015-01-21 14:57 ` Markus Armbruster
2015-01-21 15:10 ` Paolo Bonzini
2015-01-21 16:05 ` Markus Armbruster
2015-01-21 16:22 ` Paolo Bonzini [this message]
2015-01-21 17:45 ` Markus Armbruster
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=54BFD24C.90400@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).