[libvirt] [PATCH 2/2] qemuProcessVerifyGuestCPU: Avoid coverity false positive

Michal Privoznik mprivozn at redhat.com
Thu Mar 31 15:28:07 UTC 2016


On 31.03.2016 17:06, Ján Tomko wrote:
> On Thu, Mar 31, 2016 at 04:48:24PM +0200, Michal Privoznik wrote:
>> We use _LAST items in enums to mark the last position in given
>> enum. Now, if and enum is passed to switch(), compiler checks
>> that all the values from enum occur in 'case' enumeration.
>> Including _LAST. But coverity spots it's a dead code. And it
>> really is. So to resolve this, we tend to put a comment just
>> above 'case ..._LAST' notifying coverity that we know this is a
>> dead code but we want to have it that way.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/qemu/qemu_process.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
> 
> ACK.
> 
> Would it be possible to somehow store a list of false positives
> for Coverity to ignore in libvirt.git?
> Like we do with tests/.valgrind.supp.
> 
> That way we would not need to clutter up the code.
> 
> Jan
> 

That's what I've been wondering myself too. But frankly, I don't know
the answer. John?

Michal




More information about the libvir-list mailing list