Re: [PATCH 2/2] read-cache.c: fix timestamp comparison

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

 




On Tue, 22 Jan 2008, Junio C Hamano wrote:

> Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> writes:
> 
> > The stupid thing is that I literally _grepped_ for the code testing 
> > "ce_mode".
> >
> > I had missed that one because I had looked for things like
> >
> > 	if ([!].*ce_mode)
> >
> > but that switch statement meant that the comparison to zero was 
> > non-local and my grep didn't see it.
> 
> Would a patch to sparse help you in cases like this?

Heh. Sparse can do anything, but some things are more specialized than 
others. In this case, I could possibly have added a type modifier that 
says "don't compare against zero", and that kind of thing may even make 
sense (ie you can mark pointers that are known not to be NULL), and yes, 
it would have caught this.

But sparse right now doesn't have that kind of flag (the "safe expression" 
thing comes pretty close).

So yes, sparse could do things like this, but it's generally a fair amount 
of work to add specialized sparse rules.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux