]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap: Fix unmapped_area_topdown with align_offset
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 8 May 2020 02:12:58 +0000 (22:12 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 19:04:46 +0000 (15:04 -0400)
align_offset should be aligned to align_mask.. apparently.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
mm/mmap.c

index cf15423b1f4cf9e88ef6e53d2395995e43b1aa75..ef16957d5ae40c52bf274e52ea17ec6ff4e8d7f3 100644 (file)
--- 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().