]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
userfaultfd: remove redundant check in vm_uffd_ops()
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Wed, 27 May 2026 18:47:51 +0000 (21:47 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 1 Jun 2026 04:50:26 +0000 (21:50 -0700)
commit9d7bea186ba5a002456471edf36cc9b69f809397
tree1415f63fd9e5afdb805d8ef3f8beea26929ee1ee
parentdf3ee3b3bbc327f570c5451666bbaf6cf8b4436a
userfaultfd: remove redundant check in vm_uffd_ops()

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.

Link: https://lore.kernel.org/20260527184751.4147364-4-rppt@kernel.org
Fixes: 0f48947c4232 ("userfaultfd: introduce vm_uffd_ops")
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Suggested-by: Lorenzo Stoakes <ljs@kernel.org>
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: David Carlier <devnexen@gmail.com>
Cc: Michael Bommarito <michael.bommarito@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/userfaultfd.c