summaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/mmap.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-01-29 09:41:18 +0100
committerIngo Molnar <mingo@kernel.org>2016-01-29 09:41:18 +0100
commit76b36fa896a2db64582690e085f36adc76604134 (patch)
tree78007f123ead6f96cdee6ba98ac3c289c706cc39 /arch/x86/mm/mmap.c
parentx86/asm: Remove unused L3_PAGE_OFFSET (diff)
parentLinux 4.5-rc1 (diff)
downloadlinux-76b36fa896a2db64582690e085f36adc76604134.tar.xz
linux-76b36fa896a2db64582690e085f36adc76604134.zip
Merge tag 'v4.5-rc1' into x86/asm, to refresh the branch before merging new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm/mmap.c')
-rw-r--r--arch/x86/mm/mmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 844b06d67df4..96bd1e2bffaf 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -69,14 +69,14 @@ unsigned long arch_mmap_rnd(void)
{
unsigned long rnd;
- /*
- * 8 bits of randomness in 32bit mmaps, 20 address space bits
- * 28 bits of randomness in 64bit mmaps, 40 address space bits
- */
if (mmap_is_ia32())
- rnd = (unsigned long)get_random_int() % (1<<8);
+#ifdef CONFIG_COMPAT
+ rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_compat_bits) - 1);
+#else
+ rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);
+#endif
else
- rnd = (unsigned long)get_random_int() % (1<<28);
+ rnd = (unsigned long)get_random_int() & ((1 << mmap_rnd_bits) - 1);
return rnd << PAGE_SHIFT;
}