[SLOF] [PATCH v2 2/7] libc: Fix the rand() function to return non-zero values

Segher Boessenkool segher at kernel.crashing.org
Tue Dec 22 22:59:35 AEDT 2015

On Tue, Dec 22, 2015 at 11:08:38AM +0100, Thomas Huth wrote:
> The rand() function in SLOF's libc has a bug which caused the
> function to always return zero: The _rand value was shifted left
> by 16, and then ANDed with 0x7fff. Obviously, the shift operation
> should be ">>" instead of "<<".
> And while we're at it, also increase the constant for the
> multiplaction in there so that more upper bits are affected.

Have you checked that that is in fact a better random generator?

But really, don't bother with any of this, just import a known-good
random generator?  There must be many with compatible license...

I looked over the other patches in the series and nothing stuck out,
all looks good.


More information about the SLOF mailing list