Skip to contentSkip to conversation

lib/test_ubsan.c:84:23: warning: variable 'above' set but not used

PATCH kernel test robot 1 participant 1 message Nov 29

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://android.googlesource.com/kernel/common android12-5.10
head:   4c7c54d5282535632ad82a459d9a58e130a0452c
commit: 7611578ecbeb8dde637d8d65d270e242a1aae87a [1/1] UPSTREAM: ubsan: expand tests and reporting
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20261130/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261130/[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: In function 'test_ubsan_add_overflow':
lib/test_ubsan.c:17:31: warning: variable 'uval' set but not used [-Wunused-but-set-variable=]

      17 |         volatile unsigned int uval = UINT_MAX;
         |                               ^~~~
   lib/test_ubsan.c:16:22: warning: variable 'val' set but not used [-Wunused-but-set-variable=]
      16 |         volatile int val = INT_MAX;
         |                      ^~~
   lib/test_ubsan.c: In function 'test_ubsan_sub_overflow':
   lib/test_ubsan.c:29:31: warning: variable 'uval' set but not used [-Wunused-but-set-variable=]
      29 |         volatile unsigned int uval = 0;
         |                               ^~~~
   lib/test_ubsan.c:28:22: warning: variable 'val' set but not used [-Wunused-but-set-variable=]
      28 |         volatile int val = INT_MIN;
         |                      ^~~
   lib/test_ubsan.c: In function 'test_ubsan_mul_overflow':
   lib/test_ubsan.c:42:31: warning: variable 'uval' set but not used [-Wunused-but-set-variable=]
      42 |         volatile unsigned int uval = UINT_MAX / 2;
         |                               ^~~~
   lib/test_ubsan.c:41:22: warning: variable 'val' set but not used [-Wunused-but-set-variable=]
      41 |         volatile int val = INT_MAX / 2;
         |                      ^~~
   lib/test_ubsan.c: In function 'test_ubsan_divrem_overflow':
   lib/test_ubsan.c:61:22: warning: variable 'val' set but not used [-Wunused-but-set-variable=]
      61 |         volatile int val = 16;
         |                      ^~~
   lib/test_ubsan.c: In function 'test_ubsan_shift_out_of_bounds':
   lib/test_ubsan.c:72:13: warning: variable 'val2' set but not used [-Wunused-but-set-variable=]
      72 |         int val2 = INT_MAX;
         |             ^~~~
   lib/test_ubsan.c:71:13: warning: variable 'val1' set but not used [-Wunused-but-set-variable=]
      71 |         int val1 = 10;
         |             ^~~~
   lib/test_ubsan.c: In function 'test_ubsan_out_of_bounds':
   lib/test_ubsan.c:85:22: warning: variable 'arr' set but not used [-Wunused-but-set-variable=]
      85 |         volatile int arr[4];
         |                      ^~~
>> lib/test_ubsan.c:84:23: warning: variable 'above' set but not used [-Wunused-but-set-variable=]
      84 |         volatile char above[4] = { }; /* Protect surrounding memory. */
         |                       ^~~~~
   lib/test_ubsan.c: In function 'test_ubsan_load_invalid_value':
   lib/test_ubsan.c:107:44: warning: variable 'eptr' set but not used [-Wunused-but-set-variable=]
     107 |         enum ubsan_test_enum eval, eval2, *eptr;
         |                                            ^~~~
   lib/test_ubsan.c:106:26: warning: variable 'ptr' set but not used [-Wunused-but-set-variable=]
     106 |         bool val, val2, *ptr;
         |                          ^~~
   lib/test_ubsan.c: In function 'test_ubsan_null_ptr_deref':
   lib/test_ubsan.c:130:13: warning: variable 'val' set but not used [-Wunused-but-set-variable=]
     130 |         int val;
         |             ^~~
   lib/test_ubsan.c: In function 'test_ubsan_object_size_mismatch':
   lib/test_ubsan.c:150:34: warning: variable 'val2' set but not used [-Wunused-but-set-variable=]
     150 |         volatile long long *ptr, val2;
         |                                  ^~~~
   lib/test_ubsan.c: At top level:
   lib/test_ubsan.c:170:28: warning: 'skip_ubsan_array' defined but not used [-Wunused-const-variable=]
     170 | static const test_ubsan_fp skip_ubsan_array[] = {
         |                            ^~~~~~~~~~~~~~~~

vim +/above +84 lib/test_ubsan.c

    80	
    81	static void test_ubsan_out_of_bounds(void)
    82	{
    83		volatile int i = 4, j = 5, k = -1;
  > 84		volatile char above[4] = { }; /* Protect surrounding memory. */
    85		volatile int arr[4];
    86		volatile char below[4] = { }; /* Protect surrounding memory. */
    87	
    88		above[0] = below[0];
    89	
    90		UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "above");
    91		arr[j] = i;
    92	
    93		UBSAN_TEST(CONFIG_UBSAN_BOUNDS, "below");
    94		arr[k] = i;
    95	}
    96	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki