[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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




On 03/31/2016 11:28 AM, Michal Privoznik wrote:
> 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 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?
> 

I'd have to dig on this a bit... It is possible to ignore whole classes
of errors using flags to the cov-analyze command; however, that's not
the same as valgrind where you can disable based on stack patterns using
"fun:" prefixes and elipses (...).

The problem with disabling dead_error_begin warnings could be missing
something that truly is a deadcode as opposed to this one where the
reason why the deadcode shows up is because the typed switch() statement
compiler magic requires the VIR_*_LAST: entry instead of going with the
non typed one where the "default:" case would be used.


John


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]