From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] scripts: add sample model file for Coverity Scan
Date: Wed, 19 Mar 2014 11:32:39 -0600 [thread overview]
Message-ID: <5329D4B7.4090602@redhat.com> (raw)
In-Reply-To: <1395247965-13889-1-git-send-email-pbonzini@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1977 bytes --]
On 03/19/2014 10:52 AM, Paolo Bonzini wrote:
> This is the model file that is being used for the QEMU project's scans
> on scan.coverity.com. It fixed about 30 false positives (10% of the
> total) and exposed about 60 new memory leaks.
>
> The file is not automatically used; changes to it must be propagated
> to the website manually by an admin (right now Markus, Peter and me
> are admins).
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Double S-o-B looks odd.
> + *
> + * Copyright (C) 2014 Red Hat, Inc.
> + *
> + * Authors:
> + * Markus Armbruster <armbru@redhat.com>
> + * Paolo Bonzini <pbonzini@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or, at your
> + * option, any later version. See the COPYING file in the top-level directory.
Aren't the license and authors blurbs usually in the other order?
> +
> +#define NULL (void *)0
Missing ()
> +#define assert(x) if (!(x)) __coverity_panic__();
Will this break any 'if () assert(); else {}' blocks? Obviously, such
blocks already violate coding convention, but you might as well make
this definition safe to use for older code.
> +
> +static void __write(uint8_t *buf, int len)
Will the fact that you used 'int len' instead of 'size_t' bite us on 32-
vs. 64-bit? Same for __read.
> +void *
> +g_malloc0 (size_t n_bytes)
> +{
> + void *mem;
> + __coverity_negative_sink__((ssize_t) n_bytes);
> + mem = calloc(1, n_bytes == 0 ? 1 : n_bytes);
> + if (!mem) __coverity_panic__ ();
Is it worth being consistent on spacing before (?
> +void g_free (void *mem)
> +{
> + if (mem) {
> + free(mem);
> + }
Doesn't coverity already know that free(NULL) is a no-op, without you
having to repeat it?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-03-19 17:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 16:52 [Qemu-devel] [PATCH v2] scripts: add sample model file for Coverity Scan Paolo Bonzini
2014-03-19 17:32 ` Eric Blake [this message]
2014-03-19 19:46 ` Paolo Bonzini
2014-03-20 7:32 ` Markus Armbruster
2014-03-20 13:01 ` Paolo Bonzini
2014-03-26 15:37 ` Markus Armbruster
2014-03-20 8:26 ` 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=5329D4B7.4090602@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).