oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kees Cook <keescook@chromium.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [kees:devel/overflow/ubsan-only 3/6] lib/test_ubsan.c:61:17: warning: variable 'top' set but not used
Date: Wed, 31 Jan 2024 04:33:33 +0800	[thread overview]
Message-ID: <202401310423.XpCIk6KO-lkp@intel.com> (raw)

tree:   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/202401310423.XpCIk6KO-lkp@intel.com/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/202401310423.XpCIk6KO-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/202401310423.XpCIk6KO-lkp@intel.com/

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	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-01-30 20:34 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=202401310423.XpCIk6KO-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=keescook@chromium.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).