]> 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>
Tue, 5 Jan 2021 17:28:29 +0000 (12:28 -0500)
align_offset should be aligned to align_mask.. apparently.

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

index 00938d556e83908cab89a1f05c8dfb2b369e6e5c..23191dc600126649fd60611220ac98a588656ea5 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2265,8 +2265,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().