[PATCH bpf-next 1/3] bpf: Allow const char * from LSM hooks as kfunc const string arguments

kernel test robot lkp at intel.com
Thu Nov 27 19:07:07 UTC 2025


Hi Song,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bpf-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Song-Liu/bpf-Allow-const-char-from-LSM-hooks-as-kfunc-const-string-arguments/20251127-125352
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link:    https://lore.kernel.org/r/20251127005011.1872209-6-song%40kernel.org
patch subject: [PATCH bpf-next 1/3] bpf: Allow const char * from LSM hooks as kfunc const string arguments
config: loongarch-randconfig-001-20251127 (https://download.01.org/0day-ci/archive/20251128/202511280214.sckLyHDU-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project b3428bb966f1de8aa48375ffee0eba04ede133b7)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251128/202511280214.sckLyHDU-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511280214.sckLyHDU-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/bpf/verifier.c:9655:14: warning: unused variable 'tname' [-Wunused-variable]
    9655 |         const char *tname;
         |                     ^~~~~
   1 warning generated.


vim +/tname +9655 kernel/bpf/verifier.c

  9649	
  9650	/* Check for const string passed in as input to the bpf program. */
  9651	static int check_reg_const_str_arg(struct bpf_reg_state *reg)
  9652	{
  9653		const struct btf *btf;
  9654		const struct btf_type *t;
> 9655		const char *tname;
  9656	
  9657		if (base_type(reg->type) != PTR_TO_BTF_ID)
  9658			return -EINVAL;
  9659	
  9660		btf = reg->btf;
  9661		t = btf_type_by_id(btf, reg->btf_id);
  9662		if (!t)
  9663			return -EINVAL;
  9664	
  9665		if (btf_type_is_const_char_ptr(btf, t))
  9666			return 0;
  9667		return -EINVAL;
  9668	}
  9669	

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



More information about the Linux-security-module-archive mailing list