Re: [PATCH] mm: correct type for vmalloc vm_flags fields

From: Harry Yoo
Date: Wed Jul 30 2025 - 01:10:27 EST


On Tue, Jul 29, 2025 at 01:54:07PM +0100, Lorenzo Stoakes wrote:
> Hi Andrew,
>
> Please apply the below to this series.
>
> Again to re-emphasise, there's no _actual_ issue here (using a typedef for
> unsigned long vs unsigned long), it's just fixing up things in preparation
> for later changes where this will matter.
>
> Thanks,
> Lorenzo
>
> ----8<----
> From 94ccb0c9e49bf3f9a5a31e2f1da4a722b0a2de50 Mon Sep 17 00:00:00 2001
> From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Date: Tue, 29 Jul 2025 13:48:50 +0100
> Subject: [PATCH] mm: fixup very disguised vmalloc flags parameter
>
> The declare_vma() function in arm64 arch code liberally mixes the concepts
> of VMAs and near-identically named vmalloc data structures, so I
> accidentally changed the 'vm_flags' field' that is assigned to a 'vma'
> thinking it was... the vm_flags field of a vma, which it turns out, it
> isn't.
>
> Revert the type from vm_flags_t to unsigned long.
>
> Given vm_flags_t == unsigned long, there is no change in any behaviour
> before or after this patch, but in future this will matter.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> ---

Apologies for the last minute review and not reporting it at one go.

For both patches,
Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>

> arch/arm64/mm/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 20a89ab97dc5..34e5d78af076 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -721,7 +721,7 @@ void mark_rodata_ro(void)
>
> static void __init declare_vma(struct vm_struct *vma,
> void *va_start, void *va_end,
> - vm_flags_t vm_flags)
> + unsigned long vm_flags)
> {
> phys_addr_t pa_start = __pa_symbol(va_start);
> unsigned long size = va_end - va_start;
> --
> 2.50.1

--
Cheers,
Harry / Hyeonggon