aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/mm
diff options
context:
space:
mode:
authordcashman <dcashman@google.com>2016-02-24 13:31:22 -0800
committerAmit Pundir <amit.pundir@linaro.org>2016-04-07 16:49:59 +0530
commit818ad76fe6fb93c8dcbfdd4e479026fdfe14df07 (patch)
treef8678080f44b3f66fd387cf3eaefe87ca33a93a4 /arch/mips/mm
parent06bfe14bdda83b9544c6b7bd4cdf738013e51ae8 (diff)
FROMLIST: mm: ASLR: use get_random_long()
(cherry picked from commit https://lkml.org/lkml/2016/2/4/833) Replace calls to get_random_int() followed by a cast to (unsigned long) with calls to get_random_long(). Also address shifting bug which, in case of x86 removed entropy mask for mmap_rnd_bits values > 31 bits. Bug: 26963541 Signed-off-by: Daniel Cashman <dcashman@android.com> Signed-off-by: Daniel Cashman <dcashman@google.com> Change-Id: I36c156c9b8d7d157134895fddd4cd6efddcbee86
Diffstat (limited to 'arch/mips/mm')
-rw-r--r--arch/mips/mm/mmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 5c81fdd032c3..353037699512 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -146,7 +146,7 @@ unsigned long arch_mmap_rnd(void)
{
unsigned long rnd;
- rnd = (unsigned long)get_random_int();
+ rnd = get_random_long();
rnd <<= PAGE_SHIFT;
if (TASK_IS_32BIT_ADDR)
rnd &= 0xfffffful;
@@ -174,7 +174,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
static inline unsigned long brk_rnd(void)
{
- unsigned long rnd = get_random_int();
+ unsigned long rnd = get_random_long();
rnd = rnd << PAGE_SHIFT;
/* 8MB for 32bit, 256MB for 64bit */