Earlier quoted context omitted.
In what sense does it overflow? printf("%llx\n", ((long long)0xffffffff Prints: ffffffffffffffff
The idea may be to avoid shifting a 1 into the sign bit, which is undefined behavior. The values in question are being convertd back to loff_t anyway, but that's an implementation-defined conversion rather than undefined behavior. So that is to say, doing the shift in the corresponding unsigned type and then converting to the original signed type is better defined at the language level than just doing the shift in th…
Note that Linux compiles with -fwrapv or one of the similar flags that defines overflow to wrap, so this isn’t an issue. I guess this trivializes this patch more, but I figured that they might want the patch anyways in case they ever move off of the flag. (I couldn’t find a uloff_t, so I copied what other code seemed to be doing in this case.)