linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liam Howlett <liam.howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Davidlohr Bueso <dbueso@suse.de>,
	Liam Howlett <liam.howlett@oracle.com>
Subject: [PATCH v2 21/22] mm/memory.c: Use vma_lookup() in __access_remote_vm()
Date: Fri, 21 May 2021 17:48:07 +0000	[thread overview]
Message-ID: <20210521174745.2219620-22-Liam.Howlett@Oracle.com> (raw)
In-Reply-To: <20210521174745.2219620-1-Liam.Howlett@Oracle.com>

Use vma_lookup() to find the VMA at a specific address.  As vma_lookup()
will return NULL if the address is not within any VMA, the start address
no longer needs to be validated.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Acked-by: Davidlohr Bueso <dbueso@suse.de>
---
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 86ba6c1f6821..e3b56903b111 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4954,8 +4954,8 @@ int __access_remote_vm(struct mm_struct *mm, unsigned long addr, void *buf,
 			 * Check if this is a VM_IO | VM_PFNMAP VMA, which
 			 * we can access using slightly different code.
 			 */
-			vma = find_vma(mm, addr);
-			if (!vma || vma->vm_start > addr)
+			vma = vma_lookup(mm, addr);
+			if (!vma)
 				break;
 			if (vma->vm_ops && vma->vm_ops->access)
 				ret = vma->vm_ops->access(vma, addr, buf,
-- 
2.30.2

  parent reply	other threads:[~2021-05-21 17:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 17:47 [PATCH v2 00/22] mm: Add vma_lookup() Liam Howlett
2021-05-21 17:47 ` [PATCH v2 01/22] mm: Add vma_lookup(), update find_vma_intersection() comments Liam Howlett
2021-05-21 17:47 ` [PATCH v2 02/22] drm/i915/selftests: Use vma_lookup() in __igt_mmap() Liam Howlett
2021-05-21 17:47 ` [PATCH v2 04/22] arch/arm64/kvm: Use vma_lookup() instead of find_vma_intersection() Liam Howlett
2021-05-21 17:47 ` [PATCH v2 03/22] arch/arc/kernel/troubleshoot: use vma_lookup() instead of find_vma() Liam Howlett
2021-05-21 17:47 ` [PATCH v2 06/22] arch/powerpc/kvm/book3s: Use vma_lookup() in kvmppc_hv_setup_htab_rma() Liam Howlett
2021-05-21 17:47 ` [PATCH v2 05/22] arch/powerpc/kvm/book3s_hv_uvmem: Use vma_lookup() instead of find_vma_intersection() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 07/22] arch/mips/kernel/traps: Use vma_lookup() instead of find_vma() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 09/22] x86/sgx: Use vma_lookup() in sgx_encl_find() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 08/22] arch/m68k/kernel/sys_m68k: Use vma_lookup() in sys_cacheflush() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 10/22] virt/kvm: Use vma_lookup() instead of find_vma_intersection() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 11/22] vfio: " Liam Howlett
2021-05-21 17:48 ` [PATCH v2 12/22] net/ipv5/tcp: Use vma_lookup() in tcp_zerocopy_receive() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 13/22] drm/amdgpu: Use vma_lookup() in amdgpu_ttm_tt_get_user_pages() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 14/22] media: videobuf2: Use vma_lookup() in get_vaddr_frames() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 15/22] misc/sgi-gru/grufault: Use vma_lookup() in gru_find_vma() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 17/22] lib/test_hmm: Use vma_lookup() in dmirror_migrate() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 16/22] kernel/events/uprobes: Use vma_lookup() in find_active_uprobe() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 19/22] mm/migrate: Use vma_lookup() in do_pages_stat_array() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 18/22] mm/ksm: Use vma_lookup() in find_mergeable_vma() Liam Howlett
2021-05-21 17:48 ` [PATCH v2 20/22] mm/mremap: Use vma_lookup() in vma_to_resize() Liam Howlett
2021-05-21 17:48 ` Liam Howlett [this message]
2021-05-21 17:48 ` [PATCH v2 22/22] mm/mempolicy: Use vma_lookup() in __access_remote_vm() Liam Howlett
2021-05-21 18:08 ` [PATCH v2 00/22] mm: Add vma_lookup() Liam Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210521174745.2219620-22-Liam.Howlett@Oracle.com \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dbueso@suse.de \
    --cc=geert@linux-m68k.org \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).