Messages in this thread | | | From | Herbert Xu <> | Subject | Re: [PATCH] fs/fcntl.c : don't test unsigned value for less than zero | Date | Fri, 15 Apr 2005 22:03:05 +1000 |
| |
Christoph Hellwig <hch@infradead.org> wrote: > >> No, it was exactly this patch: >> http://www.ussg.iu.edu/hypermail/linux/kernel/0401.0/1816.html > > Hmm. Looks I absolutely disagree with Linus on this one ;-)
Me too. The compiler doesn't really have much choice here. If it ignores all comparisons of unsigned integers to less than zero then we could miss real bugs like this:
int foo(unsigned int val) { return val < 0; }
where the user probably wanted a signed comparison.
I suppose it could be smart and stay quiet about
val < 0 || val > BOUND
However, gcc is slow enough as it is without adding unnecessary smarts like this. -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |