summaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/mmap.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2017-09-05 11:07:05 +0200
committerJiri Kosina <jkosina@suse.cz>2017-09-05 11:07:05 +0200
commitb11918bdbe79bd002d00a9f1d78958167ccfad99 (patch)
tree931c5680a242041f49b07b20823012ae9bdb98c2 /arch/x86/mm/mmap.c
parentMerge branch 'for-4.14/asus' into for-linus (diff)
parentHID: input: throttle battery uevents (diff)
downloadlinux-b11918bdbe79bd002d00a9f1d78958167ccfad99.tar.xz
linux-b11918bdbe79bd002d00a9f1d78958167ccfad99.zip
Merge branch 'for-4.14/battery' into for-linus
- support for batteries driven by HID input reports, from Dmitry Torokhov
Diffstat (limited to 'arch/x86/mm/mmap.c')
-rw-r--r--arch/x86/mm/mmap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 797295e792b2..229d04a83f85 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -92,13 +92,18 @@ unsigned long arch_mmap_rnd(void)
static unsigned long mmap_base(unsigned long rnd, unsigned long task_size)
{
unsigned long gap = rlimit(RLIMIT_STACK);
+ unsigned long pad = stack_maxrandom_size(task_size) + stack_guard_gap;
unsigned long gap_min, gap_max;
+ /* Values close to RLIM_INFINITY can overflow. */
+ if (gap + pad > gap)
+ gap += pad;
+
/*
* Top of mmap area (just below the process stack).
* Leave an at least ~128 MB hole with possible stack randomization.
*/
- gap_min = SIZE_128M + stack_maxrandom_size(task_size);
+ gap_min = SIZE_128M;
gap_max = (task_size / 6) * 5;
if (gap < gap_min)