mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch added to -mm tree
@ 2021-05-11  1:56 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-05-11  1:56 UTC (permalink / raw)
  To: akpm, Liam.Howlett, mm-commits


The patch titled
     Subject: mm/mmap: use find_vma_intersection() in do_mmap() for overlap
has been added to the -mm tree.  Its filename is
     mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Liam Howlett <liam.howlett@oracle.com>
Subject: 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>
---

 mm/mmap.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/mm/mmap.c~mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap
+++ a/mm/mmap.c
@@ -1457,9 +1457,7 @@ unsigned long do_mmap(struct file *file,
 		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;
 	}
 
_

Patches currently in -mm which might be from liam.howlett@oracle.com are

mm-mmap-introduce-unlock_range-for-code-cleanup.patch
mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-11  1:56 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:56 + mm-mmap-use-find_vma_intersection-in-do_mmap-for-overlap.patch added to -mm tree akpm

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).