From: Andrew Morton <akpm@linux-foundation.org>
To: Yadong Qi <yadong.qi@linux.alibaba.com>
Cc: urezki@gmail.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, ying.huang@linux.alibaba.com,
dan.carpenter@linaro.org, kernel test robot <lkp@intel.com>,
Huang Ying <ying.huang@linux.alibaba.com>,
Dev Jain <dev.jain@arm.com>,
Uladzislau Rezki (Sony) <urezki@gmail.com>
Subject: Re: [PATCH] mm: vmalloc: fix uninitialized value issue
Date: Tue, 14 Oct 2025 19:09:16 -0700 [thread overview]
Message-ID: <20251014190916.e9285e8ac6a8301cdacd9fe8@linux-foundation.org> (raw)
In-Reply-To: <20251014102337.5453-1-yadong.qi@linux.alibaba.com>
On Tue, 14 Oct 2025 18:23:37 +0800 Yadong Qi <yadong.qi@linux.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?
prev parent reply other threads:[~2025-10-15 2:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 10:23 Yadong Qi
2025-10-15 2:09 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251014190916.e9285e8ac6a8301cdacd9fe8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=dev.jain@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=urezki@gmail.com \
--cc=yadong.qi@linux.alibaba.com \
--cc=ying.huang@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox