]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86: fix mmap random address range
authorLudwig Nussel <ludwig.nussel@suse.de>
Tue, 8 Nov 2011 00:19:51 +0000 (11:19 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 16 Nov 2011 01:46:50 +0000 (12:46 +1100)
commit330d6dcb970e97d04feafe67fc7bf499d02be1b9
treecd04525c476a75a9b1a48c039660f17ad0f21397
parentf587f31722cbf4f9be01d3a71f62d5d93e037d79
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