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

Re: [Xen-devel] [PATCH for-4.9] x86/mm: Placate DEADCODE Coverity warning



On 31/05/17 09:52, Julien Grall wrote:
> Hi,
>
> On 05/22/2017 02:32 PM, Jan Beulich wrote:
>>>>> On 22.05.17 at 15:12, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> _PAGE_GNTTAB is only used in debug builds of Xen; in release builds,
>>> it has
>>> the value 0.  Coverity complains that "l1e_get_flags(l1e) & 0" is
>>> logically
>>> dead.
>>>
>>> Add an extra condition into the logic to skip the flag check if
>>> _PAGE_GNTTAB
>>> is 0.
>>
>> And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look
>> logically the same (i.e. I'd expect the same warnings to be triggered
>> [or not]).
>
> I haven't seen any answer on this question. Andrew, does this patch
> still hold for Xen 4.9?

Sorry - it fell through the cracks, but yes, it does stand for 4.9.

As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very
clearly a "short circuit every thing else if this value is zero", while
the other looks like a programming mistake, which is also why I expect
this to resolve Coverity's complaint.

Unfortunately, I can't be certain that this will resolve the issue until
it gets committed, as I don't have a useful way to run Coverity on
arbitrary non-debug builds.

~Andrew

>
>>
>>> No functional change.
>>>
>>> Coverity-ID: 1362036
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>
>> So provided the change really silences Coverity:
>> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
>
> Cheers,
>


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.