]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
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>
Thu, 28 Jan 2021 02:00:45 +0000 (21:00 -0500)
When detecting a conflict with MAP_FIXED_NOREPLACE, using the new interface avoids
the need for a temp variable

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

index 965d75ce6f3d7e95cf3ffcbc0149cebdfeac1ecc..1201a78ecf3581bb90d2f35d13651339ddc07d42 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1444,9 +1444,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;
        }