]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap: Use find_vma_intersection() in do_mmap() for overlap
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 24 Nov 2020 21:23:38 +0000 (16:23 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 11 May 2021 01:40:03 +0000 (21:40 -0400)
Using find_vma_intersection() avoids the need for a temporary variable
and makes the code cleaner.

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

index 1bbb3225c9588ab8856864faf71da7cc1f94f4f3..016715924529c901d1fa2b923ef4e23b86b74e4f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1456,9 +1456,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
                return addr;
 
        if (flags & MAP_FIXED_NOREPLACE) {
-               struct vm_area_struct *vma = find_vma(mm, addr);
-
-               if (vma && vma->vm_start < addr + len)
+               if (find_vma_intersection(mm, addr, addr + len))
                        return -EEXIST;
        }