]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86: fix mmap random address range
authorLudwig Nussel <ludwig.nussel@suse.de>
Wed, 28 Sep 2011 00:49:39 +0000 (10:49 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 30 Sep 2011 04:53:09 +0000 (14:53 +1000)
commit1f1c2ba6caa8263d4ebe431de188a237cec3bf2c
tree583a38b767ddd5f3379c84d61038a77c0c2a3eee
parent68fdef51c2f6a447f799f0c7262d64e03f550038
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>
Signed-off-by: Andrew Morton <>
arch/x86/mm/mmap.c