Re: [PATCH] mm: correct type for vmalloc vm_flags fields
From: Harry Yoo
Date: Tue Jul 29 2025 - 08:11:33 EST
On Tue, Jul 29, 2025 at 12:49:06PM +0100, Lorenzo Stoakes wrote:
> Several functions refer to the unfortunately named 'vm_flags' field when
> referencing vmalloc flags, which happens to be the precise same name used
> for VMA flags.
>
> As a result these were erroneously changed to use the vm_flags_t type
> (which currently is a typedef equivalent to unsigned long).
>
> Currently this has no impact, but in future when vm_flags_t changes this
> will result in issues, so change the type to unsigned long to account for
> this.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Reported-by: Harry Yoo <harry.yoo@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/aIgSpAnU8EaIcqd9@hyeyoo/
> ---
I see one more thing in patch 3 of the series:
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 8fcf59ba39db..248d96349fd0 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -720,7 +720,7 @@ void mark_rodata_ro(void)
static void __init declare_vma(struct vm_struct *vma,
void *va_start, void *va_end,
- unsigned long vm_flags)
+ vm_flags_t vm_flags)
{
phys_addr_t pa_start = __pa_symbol(va_start);
unsigned long size = va_end - va_start;
With that, all looks good.
"struct vm_struct *vma" makes it even more confusing by the way...
--
Cheers,
Harry / Hyeonggon
> mm/execmem.c | 8 ++++----
> mm/internal.h | 2 +-
> mm/nommu.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)