kernel/module/main.c:4515:14: warning: variable 'exit' set but not used
From: kernel test robot
Date: Tue Jun 07 2022 - 05:54:00 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e71e60cd74df9386c3f684c54888f2367050b831
commit: cfc1d277891eb499b3b5354df33b30f598683e90 module: Move all into module/
date: 9 weeks ago
config: arm64-buildonly-randconfig-r011-20220607 (https://download.01.org/0day-ci/archive/20220607/202206071718.QNuYKpUb-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b92436efcb7813fc481b30f2593a4907568d917a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cfc1d277891eb499b3b5354df33b30f598683e90
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout cfc1d277891eb499b3b5354df33b30f598683e90
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash kernel/module/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> kernel/module/main.c:4515:14: warning: variable 'exit' set but not used [-Wunused-but-set-variable]
exitcall_t *exit;
^
kernel/module/main.c:4802:6: warning: no previous prototype for function 'module_layout' [-Wmissing-prototypes]
void module_layout(struct module *mod,
^
kernel/module/main.c:4802:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void module_layout(struct module *mod,
^
static
2 warnings generated.
vim +/exit +4515 kernel/module/main.c
^1da177e4c3f41 kernel/module.c Linus Torvalds 2005-04-16 4510
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4511 static void cfi_init(struct module *mod)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4512 {
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4513 #ifdef CONFIG_CFI_CLANG
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4514 initcall_t *init;
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 @4515 exitcall_t *exit;
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4516
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4517 rcu_read_lock_sched();
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4518 mod->cfi_check = (cfi_check_fn)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4519 find_kallsyms_symbol_value(mod, "__cfi_check");
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4520 init = (initcall_t *)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4521 find_kallsyms_symbol_value(mod, "__cfi_jt_init_module");
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4522 exit = (exitcall_t *)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4523 find_kallsyms_symbol_value(mod, "__cfi_jt_cleanup_module");
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4524 rcu_read_unlock_sched();
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4525
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4526 /* Fix init/exit functions to point to the CFI jump table */
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4527 if (init)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4528 mod->init = *init;
0d67e332e6df72 kernel/module.c Arnd Bergmann 2021-09-27 4529 #ifdef CONFIG_MODULE_UNLOAD
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4530 if (exit)
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4531 mod->exit = *exit;
0d67e332e6df72 kernel/module.c Arnd Bergmann 2021-09-27 4532 #endif
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4533
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4534 cfi_module_add(mod, module_addr_min);
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4535 #endif
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4536 }
cf68fffb66d60d kernel/module.c Sami Tolvanen 2021-04-08 4537
:::::: The code at line 4515 was first introduced by commit
:::::: cf68fffb66d60d96209446bfc4a15291dc5a5d41 add support for Clang CFI
:::::: TO: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
:::::: CC: Kees Cook <keescook@xxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://01.org/lkp