[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202207242252.HNteQE9R-lkp@intel.com>
Date: Sun, 24 Jul 2022 22:17:26 +0800
From: kernel test robot <lkp@...el.com>
To: Kefeng Wang <wangkefeng.wang@...wei.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>
Subject: mm/percpu.c:3007:59: warning: the comparison will always evaluate as
'true' for the address of 'pglist' will never be NULL
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 515f71412bb73ebd7f41f90e1684fc80b8730789
commit: 23f917169ef157aa7a6bf80d8c4aad6f1282852c mm: percpu: add generic pcpu_fc_alloc/free funciton
date: 6 months ago
config: mips-buildonly-randconfig-r003-20220724 (https://download.01.org/0day-ci/archive/20220724/202207242252.HNteQE9R-lkp@intel.com/config)
compiler: mips64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=23f917169ef157aa7a6bf80d8c4aad6f1282852c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 23f917169ef157aa7a6bf80d8c4aad6f1282852c
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
mm/percpu.c: In function 'pcpu_fc_alloc':
>> mm/percpu.c:3007:59: warning: the comparison will always evaluate as 'true' for the address of 'pglist' will never be NULL [-Waddress]
3007 | if (node == NUMA_NO_NODE || !node_online(node) || !NODE_DATA(node)) {
| ^
In file included from arch/mips/include/asm/mmzone.h:12,
from include/linux/mmzone.h:1099,
from include/linux/gfp.h:6,
from include/linux/mm.h:10,
from include/linux/memblock.h:13,
from mm/percpu.c:73:
arch/mips/include/asm/mach-ip27/mmzone.h:19:28: note: 'pglist' declared here
19 | struct pglist_data pglist;
| ^~~~~~
vim +3007 mm/percpu.c
2995
2996 static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align,
2997 pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn)
2998 {
2999 const unsigned long goal = __pa(MAX_DMA_ADDRESS);
3000 #ifdef CONFIG_NUMA
3001 int node = NUMA_NO_NODE;
3002 void *ptr;
3003
3004 if (cpu_to_nd_fn)
3005 node = cpu_to_nd_fn(cpu);
3006
> 3007 if (node == NUMA_NO_NODE || !node_online(node) || !NODE_DATA(node)) {
3008 ptr = memblock_alloc_from(size, align, goal);
3009 pr_info("cpu %d has no node %d or node-local memory\n",
3010 cpu, node);
3011 pr_debug("per cpu data for cpu%d %zu bytes at 0x%llx\n",
3012 cpu, size, (u64)__pa(ptr));
3013 } else {
3014 ptr = memblock_alloc_try_nid(size, align, goal,
3015 MEMBLOCK_ALLOC_ACCESSIBLE,
3016 node);
3017
3018 pr_debug("per cpu data for cpu%d %zu bytes on node%d at 0x%llx\n",
3019 cpu, size, node, (u64)__pa(ptr));
3020 }
3021 return ptr;
3022 #else
3023 return memblock_alloc_from(size, align, goal);
3024 #endif
3025 }
3026
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists