From: Liam R. Howlett Date: Tue, 24 Nov 2020 21:23:38 +0000 (-0500) Subject: mmap: Use find_vma_intersection in do_mmap() for overlap X-Git-Tag: howlett/maple_spf/20210104~47 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c22def512750c832a383e5f975976c4b7054de3c;p=users%2Fjedix%2Flinux-maple.git mmap: Use find_vma_intersection in do_mmap() for overlap 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 --- diff --git a/mm/mmap.c b/mm/mmap.c index d48a9062521c..b56c8223420d 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1443,9 +1443,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; }