Scotty Bauer wrote: > In the compat version of sysinfo, kernel/sys.c we see the following: > > /* Check to see if any memory value is too large for 32-bit and scale > * down if needed > */ > if ((s.totalram >> 32) || (s.totalswap >> 32)) {
This code is supposed to check if any of the bits in the upper half of these 64-bit values are set. > s.totalram is a u32 Oops. > the behavior is undefined. For a constant shift amount, gcc happens to generate correct code, i.e., the result is zero. (If the shift amount were not a constant, x86 processors would use only its lowest five bits, and the result would be wrong.) Anyway, it's not a good idea to rely on gcc's implementation of this undefined behaviour; the code should have used upper_32_bits() instead. Please write a patch. Regards, Clemens -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/