All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [uprobes:fix_numa_depth 7/7] arch/powerpc/mm/numa.c:914:4: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
Date: Fri, 20 Aug 2021 00:48:07 +0800	[thread overview]
Message-ID: <202108200048.LgXUXrUd-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 18088 bytes --]

CC: clang-built-linux(a)googlegroups.com
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

tree:   https://github.com/srikard/linux.git fix_numa_depth
head:   b4a46662136d812879c3199bdd8aa95d47ccde92
commit: b4a46662136d812879c3199bdd8aa95d47ccde92 [7/7] powerpc/numa: Fill distance_lookup_table for offline nodes
:::::: branch date: 34 hours ago
:::::: commit date: 34 hours ago
config: powerpc-randconfig-c003-20210818 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d2b574a4dea5b718e4386bf2e26af0126e5978ce)
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
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://github.com/srikard/linux/commit/b4a46662136d812879c3199bdd8aa95d47ccde92
        git remote add uprobes https://github.com/srikard/linux.git
        git fetch --no-tags uprobes fix_numa_depth
        git checkout b4a46662136d812879c3199bdd8aa95d47ccde92
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
   10 warnings generated.
   Suppressed 10 warnings (9 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   Suppressed 11 warnings (9 in non-user code, 2 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   11 warnings generated.
   arch/powerpc/include/asm/bitops.h:89:11: warning: The result of the left shift is undefined because the right operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
           set_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
                    ^
   include/linux/bits.h:10:30: note: expanded from macro 'BIT_MASK'
   #define BIT_MASK(nr)            (UL(1) << ((nr) % BITS_PER_LONG))
                                          ^
   arch/powerpc/mm/numa.c:1015:6: note: Calling 'parse_numa_properties'
           if (parse_numa_properties())
               ^~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:702:6: note: Assuming 'numa_enabled' is not equal to 0
           if (numa_enabled == 0) {
               ^~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:702:2: note: Taking false branch
           if (numa_enabled == 0) {
           ^
   arch/powerpc/mm/numa.c:709:6: note: 'min_common_depth' is >= 0
           if (min_common_depth < 0) {
               ^~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:709:2: note: Taking false branch
           if (min_common_depth < 0) {
           ^
   arch/powerpc/mm/numa.c:718:2: note: Assuming 'numa_debug' is 0
           dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth);
           ^
   arch/powerpc/mm/numa.c:44:26: note: expanded from macro 'dbg'
   #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
                            ^~~~~~~~~~
   arch/powerpc/mm/numa.c:718:2: note: Taking false branch
           dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth);
           ^
   arch/powerpc/mm/numa.c:44:22: note: expanded from macro 'dbg'
   #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
                        ^
   arch/powerpc/mm/numa.c:725:2: note: Assuming 'i' is < 'nr_cpu_ids'
           for_each_present_cpu(i) {
           ^
   include/linux/cpumask.h:790:36: note: expanded from macro 'for_each_present_cpu'
   #define for_each_present_cpu(cpu)  for_each_cpu((cpu), cpu_present_mask)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/cpumask.h:243:3: note: expanded from macro 'for_each_cpu'
                   (cpu) < nr_cpu_ids;)
                   ^~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:725:2: note: Loop condition is true.  Entering loop body
           for_each_present_cpu(i) {
           ^
   include/linux/cpumask.h:790:36: note: expanded from macro 'for_each_present_cpu'
   #define for_each_present_cpu(cpu)  for_each_cpu((cpu), cpu_present_mask)
                                      ^
   include/linux/cpumask.h:241:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = -1;                                \
           ^
   arch/powerpc/mm/numa.c:734:3: note: Taking true branch
                   if (nid == NUMA_NO_NODE) {
                   ^
   arch/powerpc/mm/numa.c:736:11: note: Assuming 'cpu' is null
                           BUG_ON(!cpu);
                                  ^
   arch/powerpc/include/asm/bug.h:73:27: note: expanded from macro 'BUG_ON'
           if (__builtin_constant_p(x)) {                          \
                                    ^
   arch/powerpc/mm/numa.c:736:4: note: Taking false branch
                           BUG_ON(!cpu);
                           ^
   arch/powerpc/include/asm/bug.h:73:2: note: expanded from macro 'BUG_ON'
           if (__builtin_constant_p(x)) {                          \
           ^
   arch/powerpc/mm/numa.c:736:4: note: Loop condition is false.  Exiting loop
                           BUG_ON(!cpu);
                           ^
   arch/powerpc/include/asm/bug.h:72:19: note: expanded from macro 'BUG_ON'
   #define BUG_ON(x) do {                                          \
                     ^
   arch/powerpc/mm/numa.c:741:3: note: Calling 'node_set_online'
                   node_set_online(nid);
                   ^~~~~~~~~~~~~~~~~~~~
   include/linux/nodemask.h:453:2: note: Calling 'node_set_state'
           node_set_state(nid, N_ONLINE);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/nodemask.h:421:2: note: Calling '__node_set'
           __node_set(node, &node_states[state]);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/nodemask.h:130:2: note: Calling 'set_bit'
           set_bit(node, dstp->bits);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/instrumented-atomic.h:29:2: note: Calling 'arch_set_bit'
           arch_set_bit(nr, addr);
           ^~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/bitops.h:89:11: note: The result of the left shift is undefined because the right operand is negative
           set_bits(BIT_MASK(nr), addr + BIT_WORD(nr));
                    ^
   include/linux/bits.h:10:30: note: expanded from macro 'BIT_MASK'
   #define BIT_MASK(nr)            (UL(1) << ((nr) % BITS_PER_LONG))
                                          ^  ~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/mm/numa.c:914:4: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
                           pr_warn("Levels(%d) not matching levels(%d)", nr_levels, nr_depth);
                           ^
   include/linux/printk.h:353:2: note: expanded from macro 'pr_warn'
           printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   arch/powerpc/mm/numa.c:1015:2: note: Taking true branch
           if (parse_numa_properties())
           ^
   arch/powerpc/mm/numa.c:1032:2: note: Assuming 'cpu' is >= 'nr_cpu_ids'
           for_each_possible_cpu(cpu) {
           ^
   include/linux/cpumask.h:788:36: note: expanded from macro 'for_each_possible_cpu'
   #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/cpumask.h:243:3: note: expanded from macro 'for_each_cpu'
                   (cpu) < nr_cpu_ids;)
                   ^~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:1032:2: note: Loop condition is false. Execution continues on line 1043
           for_each_possible_cpu(cpu) {
           ^
   include/linux/cpumask.h:788:36: note: expanded from macro 'for_each_possible_cpu'
   #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
                                      ^
   include/linux/cpumask.h:241:2: note: expanded from macro 'for_each_cpu'
           for ((cpu) = -1;                                \
           ^
   arch/powerpc/mm/numa.c:1043:2: note: Calling 'fake_update_distance_lookup_table'
           fake_update_distance_lookup_table();
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:870:9: note: 'nr_levels' declared without an initial value
           int i, nr_levels, nr_depth, node;
                  ^~~~~~~~~
   arch/powerpc/mm/numa.c:872:6: note: Assuming 'numa_enabled' is not equal to 0
           if (!numa_enabled)
               ^~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:872:2: note: Taking false branch
           if (!numa_enabled)
           ^
   arch/powerpc/mm/numa.c:875:6: note: Assuming 'form1_affinity' is not equal to 0
           if (!form1_affinity)
               ^~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:875:2: note: Taking false branch
           if (!form1_affinity)
           ^
   arch/powerpc/mm/numa.c:885:10: note: Assuming the condition is false
           WARN_ON(nr_depth > sizeof(distance_map));
                   ^
   arch/powerpc/include/asm/bug.h:84:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(x);                              \
                                  ^
   arch/powerpc/mm/numa.c:885:2: note: Taking false branch
           WARN_ON(nr_depth > sizeof(distance_map));
           ^
   arch/powerpc/include/asm/bug.h:85:2: note: expanded from macro 'WARN_ON'
           if (__builtin_constant_p(__ret_warn_on)) {              \
           ^
   arch/powerpc/mm/numa.c:890:2: note: Loop condition is false. Execution continues on line 908
           for_each_online_node(node) {
           ^
   include/linux/nodemask.h:515:36: note: expanded from macro 'for_each_online_node'
   #define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
                                      ^
   include/linux/nodemask.h:435:2: note: expanded from macro 'for_each_node_state'
           for_each_node_mask((__node), node_states[__state])
           ^
   include/linux/nodemask.h:379:2: note: expanded from macro 'for_each_node_mask'
           for ((node) = first_node(mask);                 \
           ^
   arch/powerpc/mm/numa.c:908:2: note: Assuming the condition is true
           for_each_node(node) {
           ^
   include/linux/nodemask.h:514:32: note: expanded from macro 'for_each_node'
   #define for_each_node(node)        for_each_node_state(node, N_POSSIBLE)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/nodemask.h:435:2: note: expanded from macro 'for_each_node_state'
           for_each_node_mask((__node), node_states[__state])
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/nodemask.h:380:3: note: expanded from macro 'for_each_node_mask'
                   (node) < MAX_NUMNODES;                  \
                   ^~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:908:2: note: Loop condition is true.  Entering loop body
           for_each_node(node) {
           ^
   include/linux/nodemask.h:514:32: note: expanded from macro 'for_each_node'
   #define for_each_node(node)        for_each_node_state(node, N_POSSIBLE)
                                      ^
   include/linux/nodemask.h:435:2: note: expanded from macro 'for_each_node_state'
           for_each_node_mask((__node), node_states[__state])
           ^
   include/linux/nodemask.h:379:2: note: expanded from macro 'for_each_node_mask'
           for ((node) = first_node(mask);                 \
           ^
   arch/powerpc/mm/numa.c:909:7: note: Assuming the condition is false
                   if (node_online(node))
                       ^
   include/linux/nodemask.h:511:27: note: expanded from macro 'node_online'
   #define node_online(node)       node_state((node), N_ONLINE)
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/mm/numa.c:909:3: note: Taking false branch
                   if (node_online(node))

vim +914 arch/powerpc/mm/numa.c

4b703a231799f4 Anton Blanchard   2005-12-13  858  
b4a46662136d81 Srikar Dronamraju 2021-06-03  859  /*
b4a46662136d81 Srikar Dronamraju 2021-06-03  860   * Scheduler expects unique number of node distances to be available at
b4a46662136d81 Srikar Dronamraju 2021-06-03  861   * boot. It uses node distance to calculate this unique node distances. On
b4a46662136d81 Srikar Dronamraju 2021-06-03  862   * POWER, node distances for offline nodes is not available. However, POWER
b4a46662136d81 Srikar Dronamraju 2021-06-03  863   * already knows unique possible node distances. Fake the offline node's
b4a46662136d81 Srikar Dronamraju 2021-06-03  864   * distance_lookup_table entries so that all possible node distances are
b4a46662136d81 Srikar Dronamraju 2021-06-03  865   * updated.
b4a46662136d81 Srikar Dronamraju 2021-06-03  866   */
b4a46662136d81 Srikar Dronamraju 2021-06-03  867  static void __init fake_update_distance_lookup_table(void)
b4a46662136d81 Srikar Dronamraju 2021-06-03  868  {
b4a46662136d81 Srikar Dronamraju 2021-06-03  869  	unsigned long distance_map;
b4a46662136d81 Srikar Dronamraju 2021-06-03  870  	int i, nr_levels, nr_depth, node;
b4a46662136d81 Srikar Dronamraju 2021-06-03  871  
b4a46662136d81 Srikar Dronamraju 2021-06-03  872  	if (!numa_enabled)
b4a46662136d81 Srikar Dronamraju 2021-06-03  873  		return;
b4a46662136d81 Srikar Dronamraju 2021-06-03  874  
b4a46662136d81 Srikar Dronamraju 2021-06-03  875  	if (!form1_affinity)
b4a46662136d81 Srikar Dronamraju 2021-06-03  876  		return;
b4a46662136d81 Srikar Dronamraju 2021-06-03  877  
b4a46662136d81 Srikar Dronamraju 2021-06-03  878  	/*
b4a46662136d81 Srikar Dronamraju 2021-06-03  879  	 * distance_ref_points_depth lists the unique numa domains
b4a46662136d81 Srikar Dronamraju 2021-06-03  880  	 * available. However it ignore LOCAL_DISTANCE. So add +1
b4a46662136d81 Srikar Dronamraju 2021-06-03  881  	 * to get the actual number of unique distances.
b4a46662136d81 Srikar Dronamraju 2021-06-03  882  	 */
b4a46662136d81 Srikar Dronamraju 2021-06-03  883  	nr_depth = distance_ref_points_depth + 1;
b4a46662136d81 Srikar Dronamraju 2021-06-03  884  
b4a46662136d81 Srikar Dronamraju 2021-06-03  885  	WARN_ON(nr_depth > sizeof(distance_map));
b4a46662136d81 Srikar Dronamraju 2021-06-03  886  
b4a46662136d81 Srikar Dronamraju 2021-06-03  887  	bitmap_zero(&distance_map, nr_depth);
b4a46662136d81 Srikar Dronamraju 2021-06-03  888  	bitmap_set(&distance_map, 0, 1);
b4a46662136d81 Srikar Dronamraju 2021-06-03  889  
b4a46662136d81 Srikar Dronamraju 2021-06-03  890  	for_each_online_node(node) {
b4a46662136d81 Srikar Dronamraju 2021-06-03  891  		int nd, distance = LOCAL_DISTANCE;
b4a46662136d81 Srikar Dronamraju 2021-06-03  892  
b4a46662136d81 Srikar Dronamraju 2021-06-03  893  		if (node == first_online_node)
b4a46662136d81 Srikar Dronamraju 2021-06-03  894  			continue;
b4a46662136d81 Srikar Dronamraju 2021-06-03  895  
b4a46662136d81 Srikar Dronamraju 2021-06-03  896  		nd = __node_distance(node, first_online_node);
b4a46662136d81 Srikar Dronamraju 2021-06-03  897  		for (i = 0; i < nr_depth; i++, distance *= 2) {
b4a46662136d81 Srikar Dronamraju 2021-06-03  898  			if (distance == nd) {
b4a46662136d81 Srikar Dronamraju 2021-06-03  899  				bitmap_set(&distance_map, i, 1);
b4a46662136d81 Srikar Dronamraju 2021-06-03  900  				break;
b4a46662136d81 Srikar Dronamraju 2021-06-03  901  			}
b4a46662136d81 Srikar Dronamraju 2021-06-03  902  		}
b4a46662136d81 Srikar Dronamraju 2021-06-03  903  		nr_levels = bitmap_weight(&distance_map, nr_depth);
b4a46662136d81 Srikar Dronamraju 2021-06-03  904  		if (nr_levels == nr_depth)
b4a46662136d81 Srikar Dronamraju 2021-06-03  905  			return;
b4a46662136d81 Srikar Dronamraju 2021-06-03  906  	}
b4a46662136d81 Srikar Dronamraju 2021-06-03  907  
b4a46662136d81 Srikar Dronamraju 2021-06-03  908  	for_each_node(node) {
b4a46662136d81 Srikar Dronamraju 2021-06-03  909  		if (node_online(node))
b4a46662136d81 Srikar Dronamraju 2021-06-03  910  			continue;
b4a46662136d81 Srikar Dronamraju 2021-06-03  911  
b4a46662136d81 Srikar Dronamraju 2021-06-03  912  		i = find_first_zero_bit(&distance_map, nr_depth);
b4a46662136d81 Srikar Dronamraju 2021-06-03  913  		if (i >= nr_depth || i == 0) {
b4a46662136d81 Srikar Dronamraju 2021-06-03 @914  			pr_warn("Levels(%d) not matching levels(%d)", nr_levels, nr_depth);
b4a46662136d81 Srikar Dronamraju 2021-06-03  915  			return;
b4a46662136d81 Srikar Dronamraju 2021-06-03  916  		}
b4a46662136d81 Srikar Dronamraju 2021-06-03  917  
b4a46662136d81 Srikar Dronamraju 2021-06-03  918  		bitmap_set(&distance_map, i, 1);
b4a46662136d81 Srikar Dronamraju 2021-06-03  919  		while (i--)
b4a46662136d81 Srikar Dronamraju 2021-06-03  920  			distance_lookup_table[node][i] = node;
b4a46662136d81 Srikar Dronamraju 2021-06-03  921  
b4a46662136d81 Srikar Dronamraju 2021-06-03  922  		nr_levels = bitmap_weight(&distance_map, nr_depth);
b4a46662136d81 Srikar Dronamraju 2021-06-03  923  		if (nr_levels == nr_depth)
b4a46662136d81 Srikar Dronamraju 2021-06-03  924  			return;
b4a46662136d81 Srikar Dronamraju 2021-06-03  925  	}
b4a46662136d81 Srikar Dronamraju 2021-06-03  926  }
b4a46662136d81 Srikar Dronamraju 2021-06-03  927  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 42086 bytes --]

                 reply	other threads:[~2021-08-19 16:48 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=202108200048.LgXUXrUd-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.