[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file f
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan |
Date: |
Wed, 19 Mar 2014 10:08:24 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Paolo Bonzini <address@hidden> writes:
> Il 18/03/2014 19:40, Markus Armbruster ha scritto:
>> > +void *
>> > +g_malloc (size_t n_bytes)
>> > +{
>> > + void *mem;
>> > + __coverity_negative_sink__((ssize_t) n_bytes);
>> > + mem = malloc(n_bytes == 0 ? 1 : n_bytes);
>> > + if (!mem) __coverity_panic__ ();
>> > + return mem;
>> > +}
>>
>> This isn't quite honest: g_malloc(0) yields NULL. Same for the other
>> allocation functions.
>
> Oh, I didn't know that.
>
> It probably would make static analysis a bit less powerful or will
> return more false positives. The NULL return for realloc (in the
> "free" case) already causes some. So I'm undecided between a more
> correct model and a more selective one (with a fat comment).
I can't see how lying to the analyzer could make it more powerful :)
It can, however, suppress false positives. Scan and find out how many?
- [Qemu-trivial] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/18
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan, Markus Armbruster, 2014/03/18
- Re: [Qemu-trivial] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/19
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan,
Markus Armbruster <=
- Re: [Qemu-trivial] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/19
- Re: [Qemu-trivial] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/19
- Re: [Qemu-trivial] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/19
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan, Markus Armbruster, 2014/03/19
- Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan, Paolo Bonzini, 2014/03/19
Re: [Qemu-trivial] [Qemu-devel] [PATCH] scripts: add sample model file for Coverity Scan, Kevin Wolf, 2014/03/19