aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
authorMike Rapoport (Microsoft) <rppt@kernel.org>2026-05-27 21:47:51 +0300
committerAndrew Morton <akpm@linux-foundation.org>2026-05-28 21:30:15 -0700
commit8cd2450c58ae681485c9f24ffcff9a71413b99e5 (patch)
tree0642f2294ce78924c34dc605d5804aa2fc56e102 /mm
parentb4bbda7f4e1b61bc04c1259a2f4ad43da7ab86be (diff)
downloadlinux-next-history-8cd2450c58ae681485c9f24ffcff9a71413b99e5.tar.gz
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/userfaultfd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 2872c71bbf369..80cc8be5725f7 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