linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: mm/percpu.c:3007:59: warning: the comparison will always evaluate as 'true' for the address of 'pglist' will never be NULL
Date: Sun, 24 Jul 2022 22:17:26 +0800	[thread overview]
Message-ID: <202207242252.HNteQE9R-lkp@intel.com> (raw)

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@intel.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


                 reply	other threads:[~2022-07-24 14:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202207242252.HNteQE9R-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@huawei.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