diff options
author | Jiri Kosina <jkosina@suse.cz> | 2017-09-05 11:07:05 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2017-09-05 11:07:05 +0200 |
commit | b11918bdbe79bd002d00a9f1d78958167ccfad99 (patch) | |
tree | 931c5680a242041f49b07b20823012ae9bdb98c2 /arch/x86/mm/mmap.c | |
parent | Merge branch 'for-4.14/asus' into for-linus (diff) | |
parent | HID: input: throttle battery uevents (diff) | |
download | linux-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.c | 7 |
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) |