lib/test_ubsan.c:61:17: warning: variable 'top' set but not used
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git devel/overflow/ubsan-only head: ec27d9baa678ce3b875e5784ba6ebbf759daabd6 commit: f6f0addd75d22b67b88a390c6f900e83f138ba3e [3/6] ubsan: Introduce CONFIG_UBSAN_POINTER_WRAP config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240131/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240131/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> lib/test_ubsan.c:61:17: warning: variable 'top' set but not used [-Wunused-but-set-variable]
61 | volatile void *top = (void *)ULONG_MAX;
| ^
>> lib/test_ubsan.c:69:17: warning: variable 'bottom' set but not used [-Wunused-but-set-variable]
69 | volatile void *bottom = (void *)1;
| ^
>> lib/test_ubsan.c:82:28: warning: variable 'half' set but not used [-Wunused-but-set-variable]
82 | volatile struct ptr_wrap *half = (void *)(ULONG_MAX - 128);
| ^
lib/test_ubsan.c:101:6: warning: variable 'val1' set but not used [-Wunused-but-set-variable]
101 | int val1 = 10;
| ^
lib/test_ubsan.c:102:6: warning: variable 'val2' set but not used [-Wunused-but-set-variable]
102 | int val2 = INT_MAX;
| ^
lib/test_ubsan.c:136:19: warning: variable 'ptr' set but not used [-Wunused-but-set-variable]
136 | bool val, val2, *ptr;
| ^
lib/test_ubsan.c:137:37: warning: variable 'eptr' set but not used [-Wunused-but-set-variable]
137 | enum ubsan_test_enum eval, eval2, *eptr;
| ^
lib/test_ubsan.c:182:28: warning: unused variable 'skip_ubsan_array' [-Wunused-const-variable]
182 | static const test_ubsan_fp skip_ubsan_array[] = {
| ^~~~~~~~~~~~~~~~8 warnings generated.
vim +/top +61 lib/test_ubsan.c
58
59 static void test_ubsan_pointer_overflow_add(void)
60 {
> 61 volatile void *top = (void *)ULONG_MAX;
62
63 UBSAN_TEST(CONFIG_UBSAN_POINTER_WRAP);
64 top += 2;
65 }
66
67 static void test_ubsan_pointer_overflow_sub(void)
68 {
> 69 volatile void *bottom = (void *)1;
70
71 UBSAN_TEST(CONFIG_UBSAN_POINTER_WRAP);
72 bottom -= 3;
73 }
74
75 struct ptr_wrap {
76 int a;
77 int b;
78 };
79
80 static void test_ubsan_pointer_overflow_mul(void)
81 {
> 82 volatile struct ptr_wrap *half = (void *)(ULONG_MAX - 128);
83 volatile int bump = 128;
84
85 UBSAN_TEST(CONFIG_UBSAN_POINTER_WRAP);
86 half += bump;
87 }
88 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki