From a16b40c835a7fa326b181e5273b8203594321ee3 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 7 May 2020 22:12:58 -0400 Subject: [PATCH] mm/mmap: Fix unmapped_area_topdown with align_offset align_offset should be aligned to align_mask.. apparently. Signed-off-by: Liam R. Howlett --- mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index cf15423b1f4c..ef16957d5ae4 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(). -- 2.50.1