lib/tests/test_kprobes.c:23:24: warning: variable 'stacktrace_driver' set but not used

From: kernel test robot

Date: Mon Mar 30 2026 - 01:29:36 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 7aaa8047eafd0bd628065b15757d9b48c5f9c07d
commit: db6fe4d61ece24193eb4d94a82d967501d53358c lib: Move KUnit tests into tests/ subdirectory
date: 1 year, 2 months ago
config: mips-randconfig-r121-20260330 (https://download.01.org/0day-ci/archive/20260330/202603301341.3yI3zdxK-lkp@xxxxxxxxx/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 054e11d1a17e5ba88bb1a8ef32fad3346e80b186)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260330/202603301341.3yI3zdxK-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603301341.3yI3zdxK-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> lib/tests/test_kprobes.c:23:24: warning: variable 'stacktrace_driver' set but not used [-Wunused-but-set-global]
23 | static unsigned long (*stacktrace_driver)(void);
| ^
1 warning generated.


vim +/stacktrace_driver +23 lib/tests/test_kprobes.c

8c1c9356429741a kernel/test_kprobes.c Ananth N Mavinakayanahalli 2008-01-30 20
1f6d3a8f5e397f5 kernel/test_kprobes.c Masami Hiramatsu 2021-10-25 21 static unsigned long (*internal_target)(void);
1f6d3a8f5e397f5 kernel/test_kprobes.c Masami Hiramatsu 2021-10-25 22 static unsigned long (*stacktrace_target)(void);
1f6d3a8f5e397f5 kernel/test_kprobes.c Masami Hiramatsu 2021-10-25 @23 static unsigned long (*stacktrace_driver)(void);
1f6d3a8f5e397f5 kernel/test_kprobes.c Masami Hiramatsu 2021-10-25 24 static unsigned long target_return_address[2];
1f6d3a8f5e397f5 kernel/test_kprobes.c Masami Hiramatsu 2021-10-25 25

:::::: The code at line 23 was first introduced by commit
:::::: 1f6d3a8f5e397f5d31afbc58d84e1dc68318b874 kprobes: Add a test case for stacktrace from kretprobe handler

:::::: TO: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
:::::: CC: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>

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