Re: [PATCH 2/6] userfaultfd: constify VMA parameter of userfaultfd_*() helpers
"Lorenzo Stoakes (ARM)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <aoxcY5n99-Pzlw_b@gremlin> |
On Sun, Aug 23, 2026 at 03:17:39PM +0300, Mike Rapoport (Microsoft) wrote:
> userfaultfd_{missing,wp,minor,rwp}() and userfaultfd_protected() only
> read the VMA.
>
> Make their vma parameter const.
>
> No functional change.
>
> Assisted-by: copilot:claude-opus-5
> Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
LGTM and compiles GTM so:
Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>
> ---
> include/linux/userfaultfd_k.h | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/userfaultfd_k.h b/include/linux/userfaultfd_k.h
> index a4351cffc60c..3396d270b159 100644
> --- a/include/linux/userfaultfd_k.h
> +++ b/include/linux/userfaultfd_k.h
> @@ -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);
> }
>
> -static inline bool userfaultfd_minor(struct vm_area_struct *vma)
> +static inline bool userfaultfd_minor(const struct vm_area_struct *vma)
> {
> return vma_test_any_mask(vma, VMA_UFFD_MINOR);
> }
>
> -static inline bool userfaultfd_rwp(struct vm_area_struct *vma)
> +static inline bool userfaultfd_rwp(const struct vm_area_struct *vma)
> {
> /*
> * Callers gate PAGE_NONE usage on this; PAGE_NONE is a BUILD_BUG()
> @@ -230,7 +230,7 @@ static inline bool userfaultfd_rwp(struct vm_area_struct *vma)
> return vma_test_single_mask(vma, VMA_UFFD_RWP);
> }
>
> -static inline bool userfaultfd_protected(struct vm_area_struct *vma)
> +static inline bool userfaultfd_protected(const struct vm_area_struct *vma)
> {
> return userfaultfd_wp(vma) || userfaultfd_rwp(vma);
> }
> @@ -353,27 +353,27 @@ static inline bool is_mergeable_vm_userfaultfd_ctx(struct vm_area_struct *vma,
> return true;
> }
>
> -static inline bool userfaultfd_missing(struct vm_area_struct *vma)
> +static inline bool userfaultfd_missing(const struct vm_area_struct *vma)
> {
> return false;
> }
>
> -static inline bool userfaultfd_wp(struct vm_area_struct *vma)
> +static inline bool userfaultfd_wp(const struct vm_area_struct *vma)
> {
> return false;
> }
>
> -static inline bool userfaultfd_minor(struct vm_area_struct *vma)
> +static inline bool userfaultfd_minor(const struct vm_area_struct *vma)
> {
> return false;
> }
>
> -static inline bool userfaultfd_rwp(struct vm_area_struct *vma)
> +static inline bool userfaultfd_rwp(const struct vm_area_struct *vma)
> {
> return false;
> }
>
> -static inline bool userfaultfd_protected(struct vm_area_struct *vma)
> +static inline bool userfaultfd_protected(const struct vm_area_struct *vma)
> {
> return false;
> }
>
> --
> 2.53.0
>
--
Cheers, Lorenzo