lkml.org 
[lkml]   [2015]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] coccinelle: assign signed result to unsigned variable
Some comments:

If you get 20 good results and 22 false positives, I'm not sure whether
high confidence is justified. That seemes more like moderate confidence.

On the other hand, I think it is possible to get rid of the false
positives. The false positives are coming from the fact that you have:

if ( \( vu < 0 \| vu <= 0 \) ) S1 else S2

This can be flipped around to

if ( ! \( vu < 0 \| vu <= 0 \) ) S2 else S1

and then when we propagate the ! into the disjunction, we get v >= 0 for
the first condition and v > 0 for the second condition. v >= 0 is always
true, so it could be reasonable to highlight it, but v > 0 is a perfectly
reasonable test for an unsigned value, and is where you are getting the
false positives from. If you want to get rid of both v >= 0 and v < 0
then you can just put disable neg_if in the initial @@, just after r, ie

@r disable neg_if@

On the other hand, if you want to keep the warning on v >= 0 but drop the
warning on v > 0, then you will have to split the rules and put the
disable neg_if on the one for v <= 0.

I think it would also be reasonable to merge the proposed semantic
patches. I guess this one gives most of the results anyway?

With recursive_includes, I got 70 results, at least 20 of which should be
false positives due to the MB case.

julia


\
 
 \ /
  Last update: 2015-10-03 09:21    [W:0.204 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site