Thread (49 messages) 49 messages, 9 authors, 2026-08-30

Re: [PATCH 2/6] userfaultfd: constify VMA parameter of userfaultfd_*() helpers

flat view

From: sashiko-bot@kernel.org
Date: 2026-08-23 12:27:50

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incomplete API refactoring: userfaultfd_wp() mock in VMA test framework was not updated to take a const VMA.
--
--- Patch [2]: [PATCH 2/6] userfaultfd: constify VMA parameter of userfaultfd_*() helpers ---
commit 6a82c674bb78b012b867cde9192fff955e6adee6
Author: Mike Rapoport (Microsoft) [off-list ref]

userfaultfd: constify VMA parameter of userfaultfd_*() helpers

This patch constifies the VMA parameter for various userfaultfd helper
functions. These helpers only read from the VMA, so this change ensures
const-correctness without affecting functionality.
quoted hunk ↗ jump to hunk
diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
index a4351cffc60ce..3396d270b159d 100644
--- a/include/linux/userfaultfd_k.h
+++ b/include/linux/userfaultfd_k.h
[ ... ]
quoted hunk ↗ jump to hunk
@@ -204,22 +204,22 @@ static inline bool uffd_disable_fault_around(struct vm_area_struct *vma)
 					VMA_UFFD_MINOR));
 }
 
-static inline bool userfaultfd_missing(struct vm_area_struct *vma)
+static inline bool userfaultfd_missing(const struct vm_area_struct *vma)
 {
 	return vma_test_any_mask(vma, VMA_UFFD_MISSING);
 }
 
-static inline bool userfaultfd_wp(struct vm_area_struct *vma)
+static inline bool userfaultfd_wp(const struct vm_area_struct *vma)
 {
 	return vma_test_any_mask(vma, VMA_UFFD_WP);
 }
[Severity: Low]
Does the mock definition of userfaultfd_wp() in the VMA test framework also
need to be updated to take a const VMA?

tools/testing/vma/include/stubs.h:userfaultfd_wp() {
	static inline bool userfaultfd_wp(struct vm_area_struct *vma)
	{
		return false;
	}
}

Leaving this mock out of sync with the actual kernel API might break the VMA
userland test suite build (due to a "discarding const qualifier" warning) if
future code passes a const struct vm_area_struct * to this function.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260823-uffd-vm-flags-v1-v1-0-3086981b33cf@kernel.org?part=2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help