* [PATCH] mm/mmap: Use find_vma_intersection() in do_mmap() for overlap
@ 2021-05-11 1:43 Liam Howlett
0 siblings, 0 replies; only message in thread
From: Liam Howlett @ 2021-05-11 1:43 UTC (permalink / raw)
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton
Cc: Liam Howlett
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 | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 1bbb3225c958..016715924529 100644
--- 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;
}
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-11 1:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-11 1:43 [PATCH] mm/mmap: Use find_vma_intersection() in do_mmap() for overlap Liam Howlett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).