[lkml]   [2018]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] scripts/coccinelle/misc/shift.cocci: detect < or > that should be a shift
On Thu, Feb 08, 2018 at 01:53:54PM +0100, Julia Lawall wrote:
> This checks for a comparison using < or > between two constants,
> considering both explicit constants (1, 2, etc) and macros defined
> with #define. False positives are possible in the latter case, when
> a macro may have multiple possible definitions and it is indeed
> necessary to check the value. There are currently two such false
> positives, in drivers/net/ethernet/chelsio/cxgb3/sge.c:
> q->fl[0].use_pages = FL0_PG_CHUNK_SIZE > 0;
> q->fl[1].use_pages = FL1_PG_CHUNK_SIZE > 0;

We could eliminate both these false postives by ignoring >> vs >. Did
searching for > actually find any bugs? I think you were right that
right shifting a constant is way less common than left shifting and I
have some smatch scripts where I ignore right shifting bugs.

On the other hand, two false positives are not a big deal.

dan carpenter

 \ /
  Last update: 2018-02-08 14:57    [W:0.037 / U:15.292 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site