David Miller wrote: > From: Chuck Lever > Date: Fri, 02 Nov 2007 15:14:26 -0400 > >> The (int) type cast in skb_truesize_check() is unneeded: without it, all >> the variable types in the conditional expression are unsigned integers. As >> it stands, the type cast causes a comparison between a signed and an >> unsigned integer, which can produce unexpected results. >> >> Signed-off-by: Chuck Lever > > This is checking for skb->truesize being decremented too much by other > code, which could cause a wraparound below zero, so we do want > negaitve checks here. If that's truly the case, document the requirement (perhaps using something the compiler itself can verify) instead of using a clever type cast trick. Here's the problem with leaving these little surprises in commonly used kernel headers. Suppose the developer of a network driver or network file system that uses one of these headers wants to employ static code analysis to identify issues introduced by new patches to their subsystem. The tool warnings generated in kernel headers are just noise, and make using such code analysis difficult.