* [kees:wip/v6.9-rc2/unsigned-overflow-sanitizer 30/109] lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub'
@ 2024-05-03 22:12 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-05-03 22:12 UTC (permalink / raw)
To: Kees Cook; +Cc: llvm, oe-kbuild-all
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git wip/v6.9-rc2/unsigned-overflow-sanitizer
head: 4eae48ae0df1d1feb751f794fa8495093e36168d
commit: 42a77f20b876489304c8e46c2b30ccb154d876bf [30/109] include/linux/percpu-defs.h: negated variable: use wrapping_sub()
config: s390-defconfig (https://download.01.org/0day-ci/archive/20240504/202405040609.gBCLgoz0-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240504/202405040609.gBCLgoz0-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405040609.gBCLgoz0-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from lib/percpu_test.c:2:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:173:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
lib/percpu_test.c:118:7: error: too few arguments provided to function-like macro invocation
118 | ul = this_cpu_sub_return(ulong_counter, ui_one);
| ^
include/linux/percpu-defs.h:503:110: note: expanded from macro 'this_cpu_sub_return'
503 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, wrapping_sub(typeof(pcp), 0 (typeof(pcp))(val)))
| ^
include/linux/overflow.h:125:9: note: macro 'wrapping_sub' defined here
125 | #define wrapping_sub(type, a, b) \
| ^
>> lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub'
118 | ul = this_cpu_sub_return(ulong_counter, ui_one);
| ^
include/linux/percpu-defs.h:503:64: note: expanded from macro 'this_cpu_sub_return'
503 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, wrapping_sub(typeof(pcp), 0 (typeof(pcp))(val)))
| ^
>> lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub'
include/linux/percpu-defs.h:503:64: note: expanded from macro 'this_cpu_sub_return'
503 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, wrapping_sub(typeof(pcp), 0 (typeof(pcp))(val)))
| ^
>> lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub'
include/linux/percpu-defs.h:503:64: note: expanded from macro 'this_cpu_sub_return'
503 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, wrapping_sub(typeof(pcp), 0 (typeof(pcp))(val)))
| ^
>> lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub'
include/linux/percpu-defs.h:503:64: note: expanded from macro 'this_cpu_sub_return'
503 | #define this_cpu_sub_return(pcp, val) this_cpu_add_return(pcp, wrapping_sub(typeof(pcp), 0 (typeof(pcp))(val)))
| ^
5 warnings and 5 errors generated.
vim +/wrapping_sub +118 lib/percpu_test.c
623fd8072c7c4d Greg Thelen 2013-11-12 19
623fd8072c7c4d Greg Thelen 2013-11-12 20 static int __init percpu_test_init(void)
623fd8072c7c4d Greg Thelen 2013-11-12 21 {
623fd8072c7c4d Greg Thelen 2013-11-12 22 /*
623fd8072c7c4d Greg Thelen 2013-11-12 23 * volatile prevents compiler from optimizing it uses, otherwise the
623fd8072c7c4d Greg Thelen 2013-11-12 24 * +ul_one/-ul_one below would replace with inc/dec instructions.
623fd8072c7c4d Greg Thelen 2013-11-12 25 */
623fd8072c7c4d Greg Thelen 2013-11-12 26 volatile unsigned int ui_one = 1;
623fd8072c7c4d Greg Thelen 2013-11-12 27 long l = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 28 unsigned long ul = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 29
623fd8072c7c4d Greg Thelen 2013-11-12 30 pr_info("percpu test start\n");
623fd8072c7c4d Greg Thelen 2013-11-12 31
623fd8072c7c4d Greg Thelen 2013-11-12 32 preempt_disable();
623fd8072c7c4d Greg Thelen 2013-11-12 33
623fd8072c7c4d Greg Thelen 2013-11-12 34 l += -1;
623fd8072c7c4d Greg Thelen 2013-11-12 35 __this_cpu_add(long_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 36 CHECK(l, long_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 37
623fd8072c7c4d Greg Thelen 2013-11-12 38 l += 1;
623fd8072c7c4d Greg Thelen 2013-11-12 39 __this_cpu_add(long_counter, 1);
623fd8072c7c4d Greg Thelen 2013-11-12 40 CHECK(l, long_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 41
623fd8072c7c4d Greg Thelen 2013-11-12 42 ul = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 43 __this_cpu_write(ulong_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 44
623fd8072c7c4d Greg Thelen 2013-11-12 45 ul += 1UL;
623fd8072c7c4d Greg Thelen 2013-11-12 46 __this_cpu_add(ulong_counter, 1UL);
623fd8072c7c4d Greg Thelen 2013-11-12 47 CHECK(ul, ulong_counter, 1);
623fd8072c7c4d Greg Thelen 2013-11-12 48
12a842683d4d60 Kees Cook 2024-01-27 49 ul += ULONG_MAX;
12a842683d4d60 Kees Cook 2024-01-27 50 __this_cpu_add(ulong_counter, ULONG_MAX);
623fd8072c7c4d Greg Thelen 2013-11-12 51 CHECK(ul, ulong_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 52
623fd8072c7c4d Greg Thelen 2013-11-12 53 ul += -(unsigned long)1;
623fd8072c7c4d Greg Thelen 2013-11-12 54 __this_cpu_add(ulong_counter, -(unsigned long)1);
623fd8072c7c4d Greg Thelen 2013-11-12 55 CHECK(ul, ulong_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 56
623fd8072c7c4d Greg Thelen 2013-11-12 57 ul = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 58 __this_cpu_write(ulong_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 59
623fd8072c7c4d Greg Thelen 2013-11-12 60 ul -= 1;
623fd8072c7c4d Greg Thelen 2013-11-12 61 __this_cpu_dec(ulong_counter);
623fd8072c7c4d Greg Thelen 2013-11-12 62 CHECK(ul, ulong_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 63 CHECK(ul, ulong_counter, ULONG_MAX);
623fd8072c7c4d Greg Thelen 2013-11-12 64
623fd8072c7c4d Greg Thelen 2013-11-12 65 l += -ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 66 __this_cpu_add(long_counter, -ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 67 CHECK(l, long_counter, 0xffffffff);
623fd8072c7c4d Greg Thelen 2013-11-12 68
623fd8072c7c4d Greg Thelen 2013-11-12 69 l += ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 70 __this_cpu_add(long_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 71 CHECK(l, long_counter, (long)0x100000000LL);
623fd8072c7c4d Greg Thelen 2013-11-12 72
623fd8072c7c4d Greg Thelen 2013-11-12 73
623fd8072c7c4d Greg Thelen 2013-11-12 74 l = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 75 __this_cpu_write(long_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 76
623fd8072c7c4d Greg Thelen 2013-11-12 77 l -= ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 78 __this_cpu_sub(long_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 79 CHECK(l, long_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 80
623fd8072c7c4d Greg Thelen 2013-11-12 81 l = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 82 __this_cpu_write(long_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 83
623fd8072c7c4d Greg Thelen 2013-11-12 84 l += ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 85 __this_cpu_add(long_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 86 CHECK(l, long_counter, 1);
623fd8072c7c4d Greg Thelen 2013-11-12 87
623fd8072c7c4d Greg Thelen 2013-11-12 88 l += -ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 89 __this_cpu_add(long_counter, -ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 90 CHECK(l, long_counter, (long)0x100000000LL);
623fd8072c7c4d Greg Thelen 2013-11-12 91
623fd8072c7c4d Greg Thelen 2013-11-12 92 l = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 93 __this_cpu_write(long_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 94
623fd8072c7c4d Greg Thelen 2013-11-12 95 l -= ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 96 this_cpu_sub(long_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 97 CHECK(l, long_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 98 CHECK(l, long_counter, ULONG_MAX);
623fd8072c7c4d Greg Thelen 2013-11-12 99
623fd8072c7c4d Greg Thelen 2013-11-12 100 ul = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 101 __this_cpu_write(ulong_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 102
623fd8072c7c4d Greg Thelen 2013-11-12 103 ul += ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 104 __this_cpu_add(ulong_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 105 CHECK(ul, ulong_counter, 1);
623fd8072c7c4d Greg Thelen 2013-11-12 106
623fd8072c7c4d Greg Thelen 2013-11-12 107 ul = 0;
623fd8072c7c4d Greg Thelen 2013-11-12 108 __this_cpu_write(ulong_counter, 0);
623fd8072c7c4d Greg Thelen 2013-11-12 109
623fd8072c7c4d Greg Thelen 2013-11-12 110 ul -= ui_one;
623fd8072c7c4d Greg Thelen 2013-11-12 111 __this_cpu_sub(ulong_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 112 CHECK(ul, ulong_counter, -1);
623fd8072c7c4d Greg Thelen 2013-11-12 113 CHECK(ul, ulong_counter, ULONG_MAX);
623fd8072c7c4d Greg Thelen 2013-11-12 114
623fd8072c7c4d Greg Thelen 2013-11-12 115 ul = 3;
623fd8072c7c4d Greg Thelen 2013-11-12 116 __this_cpu_write(ulong_counter, 3);
623fd8072c7c4d Greg Thelen 2013-11-12 117
623fd8072c7c4d Greg Thelen 2013-11-12 @118 ul = this_cpu_sub_return(ulong_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 119 CHECK(ul, ulong_counter, 2);
623fd8072c7c4d Greg Thelen 2013-11-12 120
623fd8072c7c4d Greg Thelen 2013-11-12 121 ul = __this_cpu_sub_return(ulong_counter, ui_one);
623fd8072c7c4d Greg Thelen 2013-11-12 122 CHECK(ul, ulong_counter, 1);
623fd8072c7c4d Greg Thelen 2013-11-12 123
623fd8072c7c4d Greg Thelen 2013-11-12 124 preempt_enable();
623fd8072c7c4d Greg Thelen 2013-11-12 125
623fd8072c7c4d Greg Thelen 2013-11-12 126 pr_info("percpu test done\n");
623fd8072c7c4d Greg Thelen 2013-11-12 127 return -EAGAIN; /* Fail will directly unload the module */
623fd8072c7c4d Greg Thelen 2013-11-12 128 }
623fd8072c7c4d Greg Thelen 2013-11-12 129
:::::: The code at line 118 was first introduced by commit
:::::: 623fd8072c7c4d77a184bc9e35192acf480c18e4 percpu: add test module for various percpu operations
:::::: TO: Greg Thelen <gthelen@google.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-03 22:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03 22:12 [kees:wip/v6.9-rc2/unsigned-overflow-sanitizer 30/109] lib/percpu_test.c:118:7: error: use of undeclared identifier 'wrapping_sub' kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox