[dm-devel] [bug report] dm: add statistics support

Dan Carpenter dan.carpenter at oracle.com
Fri Mar 16 10:54:37 UTC 2018


On Fri, Mar 16, 2018 at 01:52:20PM +0300, Dan Carpenter wrote:
> Gar.  I'm sorry, this is really new code and you're right that it's
> buggy.
> 
> On Thu, Mar 15, 2018 at 03:25:52PM -0400, Mikulas Patocka wrote:
> > > The patch fd2ed4d25270: "dm: add statistics support" from Aug 16,
> > > 2013, leads to the following static checker warning:
> > > 
> > > 	drivers/md/dm-stats.c:371 dm_stats_create()
> > > 	warn: dead code because of 's->id == ((~0 >> 1))' and 'tmp_s->id < s->id'
> > 
> > ((~0 >> 1)) is -1 and we are comparing it against INT_MAX. Perhaps the 
> > static checker is buggy because it believes that INT_MAX is -1.
> > 
> > INT_MAX definition in the linux kernel is ((int)(~0U>>1)).
> > 
> 
> Yeah, the format of the smatch outputs is bad.  It gets INT_MAX correct
> internally it just prints it out badly.  The problem here is that Smatch
> is crap at parsing loops.  Parsing seems like an essential thing, but

Parsing *loops*, I meant.

regards,
dan carpenter

> you'd be surprised how many times you can get away with parsing them
> badly.  The main issue is that parsing them correctly is probably a big
> slow down because you'd have to go through a lot of code twice...
> 
> Anyway, thanks for looking at this and sorry for the noise.
> 
> regards,
> dan carpenter




More information about the dm-devel mailing list