]> 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>
Thu, 29 Sep 2011 06:07:50 +0000 (16:07 +1000)
commit92d98ad6792ae525ff79aef7bc999693a7b2f092
tree18813deb66efedfc9b7ed57c184988f52f551dc5
parent08ebefe91fc3f02383a132c2c1d0408b4b3bcfb5
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