[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251014190916.e9285e8ac6a8301cdacd9fe8@linux-foundation.org>
Date: Tue, 14 Oct 2025 19:09:16 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yadong Qi <yadong.qi@...ux.alibaba.com>
Cc: urezki@...il.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
ying.huang@...ux.alibaba.com, dan.carpenter@...aro.org, kernel test robot
<lkp@...el.com>, Huang Ying <ying.huang@...ux.alibaba.com>, Dev Jain
<dev.jain@....com>, Uladzislau Rezki (Sony) <urezki@...il.com>
Subject: Re: [PATCH] mm: vmalloc: fix uninitialized value issue
On Tue, 14 Oct 2025 18:23:37 +0800 Yadong Qi <yadong.qi@...ux.alibaba.com> wrote:
> Issues reported by LKP:
> mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err'.
> mm/vmalloc.c:243 vmap_pud_range() error: uninitialized symbol 'err'.
> mm/vmalloc.c:295 vmap_p4d_range() error: uninitialized symbol 'err'.
>
> Fix by initailizing err with 0.
This fixes warnings which were introduced by mm.git's recent "mm:
vmalloc: WARN_ON if mapping size is not PAGE_SIZE aligned". Please do
point out such details.
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -170,7 +170,7 @@ static int vmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
> {
> pmd_t *pmd;
> unsigned long next;
> - int err;
> + int err = 0;
>
> pmd = pmd_alloc_track(&init_mm, pud, addr, mask);
> if (!pmd)
So we get the below:
: static int vmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
: phys_addr_t phys_addr, pgprot_t prot,
: unsigned int max_page_shift, pgtbl_mod_mask *mask)
: {
: pmd_t *pmd;
: unsigned long next;
: int err = 0;
:
: pmd = pmd_alloc_track(&init_mm, pud, addr, mask);
: if (!pmd)
: return -ENOMEM;
: do {
: next = pmd_addr_end(addr, end);
:
: if (vmap_try_huge_pmd(pmd, addr, next, phys_addr, prot,
: max_page_shift)) {
: *mask |= PGTBL_PMD_MODIFIED;
: continue;
: }
:
: err = vmap_pte_range(pmd, addr, next, phys_addr, prot, max_page_shift, mask);
: if (err)
: break;
: } while (pmd++, phys_addr += (next - addr), addr = next, addr != end);
: return err;
: }
If every single pmd fails vmap_try_huge_pmd() then this function
returns zero, indicating success. Is this behavior correct and
desirable?
Powered by blists - more mailing lists