qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] vnc: fix coverity warning


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] vnc: fix coverity warning
Date: Thu, 12 Feb 2015 10:27:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Gerd Hoffmann <address@hidden> writes:

>> > +    assert(vs);
>> >      return vnc_socket_local_addr("%s:%s", vs->lsock);
>> >  }
>> >  
>> > 
>> 
>> If you want, I can just silence the warning in Coverity.
>
> I think in the source code is better, human readers might wonder too. 
>
> And in case the calling code ever changes behavior the assert will trap
> it (even though it is highly unlikely in this specific case).

I'm very much in favor of using assertions to guide Coverity.  Besides
human readers, they may also help other static analyzers, including
optimizers.

Speaking of silencing defects: we could also explore use of code
annotations.  Example given in the manual:

    x = NULL;
    ...
    // coverity[var_deref_op]
    *x = 0;

The comment automatically classifies the FORWARD_NULL as intentional.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]