From: David Howells <dhowells@redhat.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, uclinux-dev@uclinux.org,
dhowells@redhat.com
Subject: [PATCH] NOMMU: Use find_vma() rather than reimplementing a VMA search
Date: Thu, 31 Aug 2006 18:27:20 +0100 [thread overview]
Message-ID: <20060831172720.11210.7261.stgit@warthog.cambridge.redhat.com> (raw)
From: David Howells <dhowells@redhat.com>
Use find_vma() in the NOMMU version of access_process_vm() rather than
reimplementing it.
Signed-Off-By: David Howells <dhowells@redhat.com>
---
mm/nommu.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/mm/nommu.c b/mm/nommu.c
index 663ec1c..51e17b9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1039,6 +1039,7 @@ unsigned long do_mremap(unsigned long ad
/*
* Look up the first VMA which satisfies addr < vm_end, NULL if none
+ * - should be called with mm->mmap_sem at least readlocked
*/
struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
{
@@ -1213,7 +1214,6 @@ struct page *filemap_nopage(struct vm_ar
*/
int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
{
- struct vm_list_struct *vml;
struct vm_area_struct *vma;
struct mm_struct *mm;
@@ -1227,13 +1227,8 @@ int access_process_vm(struct task_struct
down_read(&mm->mmap_sem);
/* the access must start within one of the target process's mappings */
- for (vml = mm->context.vmlist; vml; vml = vml->next)
- if (addr >= vml->vma->vm_start && addr < vml->vma->vm_end)
- break;
-
- if (vml) {
- vma = vml->vma;
-
+ vma = find_vma(mm, addr);
+ if (vma) {
/* don't overrun this mapping */
if (addr + len >= vma->vm_end)
len = vma->vm_end - addr;
reply other threads:[~2006-08-31 17:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20060831172720.11210.7261.stgit@warthog.cambridge.redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=uclinux-dev@uclinux.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
all inboxes | Powered by JetHome®