From: David Hildenbrand <david@redhat.com>
To: Miaohe Lin <linmiaohe@huawei.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/mremap:: Use vma_lookup() instead of find_vma()
Date: Mon, 14 Mar 2022 14:12:10 +0100 [thread overview]
Message-ID: <9cb7c909-eded-4933-c7a5-a7aa5a5221da@redhat.com> (raw)
In-Reply-To: <20220312083118.48284-1-linmiaohe@huawei.com>
On 12.03.22 09:31, Miaohe Lin wrote:
> Using vma_lookup() verifies the address is contained in the found vma.
> This results in easier to read the code.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> mm/mremap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 002eec83e91e..9d76da79594d 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -942,8 +942,8 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
>
> if (mmap_write_lock_killable(current->mm))
> return -EINTR;
> - vma = find_vma(mm, addr);
> - if (!vma || vma->vm_start > addr) {
> + vma = vma_lookup(mm, addr);
> + if (!vma) {
> ret = EFAULT;
> goto out;
> }
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2022-03-14 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-12 8:31 Miaohe Lin
2022-03-14 13:12 ` David Hildenbrand [this message]
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=9cb7c909-eded-4933-c7a5-a7aa5a5221da@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linmiaohe@huawei.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