linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: <yadong.qi@linux.alibaba.com>
To: "'Dan Carpenter'" <dan.carpenter@linaro.org>,
	<oe-kbuild@lists.linux.dev>
Cc: <lkp@intel.com>, <oe-kbuild-all@lists.linux.dev>,
	"'Andrew Morton'" <akpm@linux-foundation.org>,
	"'Linux Memory Management List'" <linux-mm@kvack.org>,
	"'Huang Ying'" <ying.huang@linux.alibaba.com>
Subject: RE: [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err'.
Date: Tue, 14 Oct 2025 17:27:24 +0800	[thread overview]
Message-ID: <003201dc3cec$c0697f40$413c7dc0$@linux.alibaba.com> (raw)
In-Reply-To: <202510110050.VG9YKMRK-lkp@intel.com>

> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@linaro.org>
> Sent: 2025年10月14日 16:28
> To: oe-kbuild@lists.linux.dev; Yadong Qi <yadong.qi@linux.alibaba.com>
> Cc: lkp@intel.com; oe-kbuild-all@lists.linux.dev; Andrew Morton
> <akpm@linux-foundation.org>; Linux Memory Management List
> <linux-mm@kvack.org>; Huang Ying <ying.huang@linux.alibaba.com>
> Subject: [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range()
> error: uninitialized symbol 'err'.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> head:   dbf0247637dd0601a462793035bdd0b416b30e36
> commit: dbf0247637dd0601a462793035bdd0b416b30e36 [114/114] mm:
> vmalloc: WARN_ON if mapping size is not PAGE_SIZE aligned
> config: sparc-randconfig-r071-20251010
> (https://download.01.org/0day-ci/archive/20251011/202510110050.VG9YKMRK-l
> kp@intel.com/config)
> compiler: sparc-linux-gcc (GCC) 8.5.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version
of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202510110050.VG9YKMRK-lkp@intel.com/
> 
> smatch warnings:
> 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'.
> 
> vim +/err +191 mm/vmalloc.c
> 
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  167  static int
> vmap_pmd_range(pud_t *pud, unsigned long addr, unsigned long end,
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  168
phys_addr_t
> phys_addr, pgprot_t prot,
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  169  			unsigned
int
> max_page_shift, pgtbl_mod_mask *mask)
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  170  {
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  171  	pmd_t *pmd;
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  172  	unsigned long next;
> dbf0247637dd06 Yadong Qi       2025-10-10  173  	int err;
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  174
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  175  	pmd =
> pmd_alloc_track(&init_mm, pud, addr, mask);
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  176  	if (!pmd)
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  177  		return -ENOMEM;
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  178  	do {
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  179  		next =
> pmd_addr_end(addr, end);
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  180
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  181  		if
> (vmap_try_huge_pmd(pmd, addr, next, phys_addr, prot,
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  182
> 	max_page_shift)) {
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  183  			*mask |=
> PGTBL_PMD_MODIFIED;
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  184
continue;
> 
> Is it possible to hit the continue on every iteration through the loop?
> 
Yes, this is an issue. I will submit an addon patch to fix it.

> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  185  		}
> 5e9e3d777b99aa Nicholas Piggin 2021-04-29  186
> dbf0247637dd06 Yadong Qi       2025-10-10  187  		err =
> vmap_pte_range(pmd, addr, next, phys_addr, prot, max_page_shift, mask);
> dbf0247637dd06 Yadong Qi       2025-10-10  188  		if (err)
> dbf0247637dd06 Yadong Qi       2025-10-10  189  			break;
> 
> I always feel like these are better as a "return ret;" anyway.  Then it's
> just one line to read instead of needing to "break; ... return err;".
> Twice as fast to read one line vs two lines.
> 
I prefer to keep same style in vmalloc.c.





      reply	other threads:[~2025-10-14  9:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  8:28 Dan Carpenter
2025-10-14  9:27 ` yadong.qi [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='003201dc3cec$c0697f40$413c7dc0$@linux.alibaba.com' \
    --to=yadong.qi@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --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