]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86: fix mmap random address range
authorLudwig Nussel <ludwig.nussel@suse.de>
Mon, 24 Oct 2011 14:53:30 +0000 (01:53 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 25 Oct 2011 08:47:34 +0000 (19:47 +1100)
commit934a7722707a21657570f6ae66f659a888cc84f7
tree0f5c5f89f6afd27040d26372128cce94b2d293f8
parent1977029e00eed49a58019bcd1d6181980438cdbc
x86: fix mmap random address range

On x86_32 casting the unsigned int result of get_random_int() to long may
result in a negative value.  On x86_32 the range of mmap_rnd() therefore
was -255 to 255.  The 32bit mode on x86_64 used 0 to 255 as intended.

The bug was introduced by 675a081 ("x86: unify mmap_{32|64}.c") in January
2008.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Harvey Harrison <harvey.harrison@gmail.com>
Cc: <stable@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/mm/mmap.c