From a9e0493d3c4f6e9b36a2ea16b355a42b97cb6ab6 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 24 Nov 2020 16:23:38 -0500 Subject: [PATCH] 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 --- mm/mmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 5533344dfc56..07c8803bc5a5 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1435,9 +1435,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; } -- 2.50.1