From: Liam R. Howlett Date: Fri, 8 May 2020 02:12:58 +0000 (-0400) Subject: mm/mmap: Fix unmapped_area_topdown with align_offset X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a16b40c835a7fa326b181e5273b8203594321ee3;p=users%2Fjedix%2Flinux-maple.git mm/mmap: Fix unmapped_area_topdown with align_offset align_offset should be aligned to align_mask.. apparently. Signed-off-by: Liam R. Howlett --- diff --git a/mm/mmap.c b/mm/mmap.c index cf15423b1f4cf..ef16957d5ae40 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2267,8 +2267,8 @@ static unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) return -ENOMEM; rcu_read_unlock(); - gap = (mas.index + info->align_mask - info->align_offset) & - (~info->align_mask); + gap = (mas.index + info->align_mask) & ~info->align_mask; + gap -= info->align_offset & info->align_mask; /* * Adjust search limits by the desired length. * See implementation comment at top of unmapped_area().