Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <ljs@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	 David Carlier <devnexen@gmail.com>,
	David Hildenbrand <david@kernel.org>,
	 Heechan Kang <gganji11@naver.com>,
	"Liam R. Howlett" <liam@infradead.org>,
	 Michael Bommarito <michael.bommarito@gmail.com>,
	Peter Xu <peterx@redhat.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] userfaultfd: remove redundant check in vm_uffd_ops()
Date: Thu, 28 May 2026 14:10:01 +0100	[thread overview]
Message-ID: <ahg-iFdkbl8p8E75@lucifer> (raw)
In-Reply-To: <20260527184751.4147364-4-rppt@kernel.org>

On Wed, May 27, 2026 at 09:47:51PM +0300, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
>
> Lorenzo says:
>
>   static const struct vm_uffd_ops *vma_uffd_ops(struct vm_area_struct *vma)
>   {
>           if (vma_is_anonymous(vma))
>                   return &anon_uffd_ops;
>           return vma->vm_ops ? vma->vm_ops->uffd_ops : NULL;
>   }
>
>   This is doing a redundant check _and_ making life confusing, as if
>   !vma->vm_ops is a condition that can be reached there, it can't, as
>   vma_is_anonymous() is literally a !vma->vm_ops check :)
>
> Remove the redundant check.
>
> Suggested-by: Lorenzo Stoakes <ljs@kernel.org>
> Fixes: 0f48947c4232 ("userfaultfd: introduce vm_uffd_ops")
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>

:) thanks! LGTM so:

Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>

> ---
>  mm/userfaultfd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
> index 2872c71bbf36..80cc8be5725f 100644
> --- a/mm/userfaultfd.c
> +++ b/mm/userfaultfd.c
> @@ -68,7 +68,7 @@ static const struct vm_uffd_ops *vma_uffd_ops(struct vm_area_struct *vma)
>  {
>  	if (vma_is_anonymous(vma))
>  		return &anon_uffd_ops;
> -	return vma->vm_ops ? vma->vm_ops->uffd_ops : NULL;
> +	return vma->vm_ops->uffd_ops;
>  }
>
>  static __always_inline
> --
> 2.53.0
>

Cheers, Lorenzo


      reply	other threads:[~2026-05-28 13:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 18:47 [PATCH v2 0/3] userfaultfd: verify VMA state across UFFDIO_COPY retry Mike Rapoport
2026-05-27 18:47 ` [PATCH v2 1/3] " Mike Rapoport
2026-05-28 13:31   ` Lorenzo Stoakes
2026-05-28 14:41     ` Mike Rapoport
2026-05-28 21:04       ` Andrew Morton
2026-05-27 18:47 ` [PATCH v2 2/3] userfaultfd: refuse to __mfill_atomic_pte() for unsupported VMAs Mike Rapoport
2026-05-27 19:09   ` David CARLIER
2026-05-28  7:33     ` Mike Rapoport
2026-05-28  7:34       ` David CARLIER
2026-05-28 13:11   ` Lorenzo Stoakes
2026-05-27 18:47 ` [PATCH v2 3/3] userfaultfd: remove redundant check in vm_uffd_ops() Mike Rapoport
2026-05-28 13:10   ` Lorenzo Stoakes [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=ahg-iFdkbl8p8E75@lucifer \
    --to=ljs@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=devnexen@gmail.com \
    --cc=gganji11@naver.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=michael.bommarito@gmail.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.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