* [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err'.
@ 2025-10-14 8:28 Dan Carpenter
2025-10-14 9:27 ` yadong.qi
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-10-14 8:28 UTC (permalink / raw)
To: oe-kbuild, Yadong Qi
Cc: lkp, oe-kbuild-all, Andrew Morton, Linux Memory Management List,
Huang Ying
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-lkp@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?
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.
5e9e3d777b99aa Nicholas Piggin 2021-04-29 190 } while (pmd++, phys_addr += (next - addr), addr = next, addr != end);
dbf0247637dd06 Yadong Qi 2025-10-10 @191 return err;
5e9e3d777b99aa Nicholas Piggin 2021-04-29 192 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err'.
2025-10-14 8:28 [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err' Dan Carpenter
@ 2025-10-14 9:27 ` yadong.qi
0 siblings, 0 replies; 2+ messages in thread
From: yadong.qi @ 2025-10-14 9:27 UTC (permalink / raw)
To: 'Dan Carpenter', oe-kbuild
Cc: lkp, oe-kbuild-all, 'Andrew Morton',
'Linux Memory Management List', 'Huang Ying'
> -----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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-14 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-14 8:28 [akpm-mm:mm-new 114/114] mm/vmalloc.c:191 vmap_pmd_range() error: uninitialized symbol 'err' Dan Carpenter
2025-10-14 9:27 ` yadong.qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox