summaryrefslogtreecommitdiff
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorLiam Howlett <liam.howlett@oracle.com>2021-06-29 05:38:44 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-06-29 20:53:51 +0300
commit35e43c5ff4d2da700e8ed2216acae81f62800eaa (patch)
treefbbee22661dbbc52ecdc5ba84cf508f8130a6377 /mm/mmap.c
parent96d990239e31d9623fdb96e829237b997c9d3d63 (diff)
downloadlinux-35e43c5ff4d2da700e8ed2216acae81f62800eaa.tar.xz
mm/mmap: use find_vma_intersection() in do_mmap() for overlap
Using find_vma_intersection() avoids the need for a temporary variable and makes the code cleaner. Link: https://lkml.kernel.org/r/20210511014328.2902782-1-Liam.Howlett@Oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index d72716f7a0b4..d8c92ae50565 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1457,9 +1457,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;
}