Trond Myklebust wrote: > On Mon, 2007-08-06 at 11:56 -0400, Chuck Lever wrote: >> Currently these are not harmful because the range of "len" is less than the >> size of a page. > > NACK. It is always safe to test an unsigned quantity against a signed > quantity for equality, _provided_ that the two quantities are the same > size. Since we're comparing an unsigned int to an int, that is clearly > the case here. > > The explicit cast is not only unnecessary, but it is actually bad, since > it may obscure any future comparison errors should we ever for some > reason decide to change the size of err. As an aside, the purpose of the patches fixing these casts is not just to correct run-time bugs, but also to eliminate compiler and sparse warnings, which in some cases are simply extraneous noise due to compiler pickiness, but can sometimes be nasty bugs (as we found out in fs/nfs/direct.c, recently). Eventually I think we should use sparse as part of a check-in test suite, and -Wall all the time for building both fs/nfs and net/sunrpc, as this setting does catch valid bugs. In that event, eliminating spurious compiler and sparse warnings will cut down on noise and make it easy to spot new problems as we are developing.