All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf-next:master 33/40] kernel/bpf/verifier.c:12762:17-18: WARNING opportunity for max()
@ 2026-09-13 14:35 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-13 14:35 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Yonghong Song <yonghong.song@linux.dev>
CC: Alexei Starovoitov <ast@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
head:   a41c69c6ea14596cfd95978483166d4eff52435e
commit: 1e6c598b02e72ddd62b4d4e0c05159794b8bddbf [33/40] bpf: Prepare kfunc arguments for the JIT from an ABI description
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: hexagon-randconfig-r062-20260913 (https://download.01.org/0day-ci/archive/20260913/202609131635.g284ODRz-lkp@intel.com/config)
compiler: clang version 21.1.6 (https://github.com/llvm/llvm-project a832a5222e489298337fbb5876f8dcaf072c5cca)

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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202609131635.g284ODRz-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> kernel/bpf/verifier.c:12762:17-18: WARNING opportunity for max()

vim +12762 kernel/bpf/verifier.c

1e6c598b02e72d Yonghong Song 2026-09-12  12751  
1e6c598b02e72d Yonghong Song 2026-09-12  12752  static u32 __btf_func_arg_align(const struct btf *btf, const struct btf_type *t, int rec)
1e6c598b02e72d Yonghong Song 2026-09-12  12753  {
1e6c598b02e72d Yonghong Song 2026-09-12  12754  	const struct btf_member *member;
1e6c598b02e72d Yonghong Song 2026-09-12  12755  	const struct btf_type *mt;
1e6c598b02e72d Yonghong Song 2026-09-12  12756  	u32 align, i;
1e6c598b02e72d Yonghong Song 2026-09-12  12757  
1e6c598b02e72d Yonghong Song 2026-09-12  12758  	while (btf_type_is_array(t))
1e6c598b02e72d Yonghong Song 2026-09-12  12759  		t = btf_type_skip_modifiers(btf, btf_array(t)->type, NULL);
1e6c598b02e72d Yonghong Song 2026-09-12  12760  
1e6c598b02e72d Yonghong Song 2026-09-12  12761  	if (btf_type_is_int(t))
1e6c598b02e72d Yonghong Song 2026-09-12 @12762  		return t->size > BPF_REG_SIZE ? t->size : BPF_REG_SIZE;
1e6c598b02e72d Yonghong Song 2026-09-12  12763  	if (!btf_type_is_struct(t))
1e6c598b02e72d Yonghong Song 2026-09-12  12764  		return BPF_REG_SIZE;
1e6c598b02e72d Yonghong Song 2026-09-12  12765  	if (rec >= BTF_MEMBER_MAX_DEPTH)
1e6c598b02e72d Yonghong Song 2026-09-12  12766  		return 0;
1e6c598b02e72d Yonghong Song 2026-09-12  12767  
1e6c598b02e72d Yonghong Song 2026-09-12  12768  	for_each_member(i, t, member) {
1e6c598b02e72d Yonghong Song 2026-09-12  12769  		mt = btf_type_skip_modifiers(btf, member->type, NULL);
1e6c598b02e72d Yonghong Song 2026-09-12  12770  		align = __btf_func_arg_align(btf, mt, rec + 1);
1e6c598b02e72d Yonghong Song 2026-09-12  12771  		if (!align)
1e6c598b02e72d Yonghong Song 2026-09-12  12772  			return 0;
1e6c598b02e72d Yonghong Song 2026-09-12  12773  		if (align > BPF_REG_SIZE)
1e6c598b02e72d Yonghong Song 2026-09-12  12774  			return 2 * BPF_REG_SIZE;
1e6c598b02e72d Yonghong Song 2026-09-12  12775  	}
1e6c598b02e72d Yonghong Song 2026-09-12  12776  	return BPF_REG_SIZE;
1e6c598b02e72d Yonghong Song 2026-09-12  12777  }
1e6c598b02e72d Yonghong Song 2026-09-12  12778  

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-13 14:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-13 14:35 [bpf-next:master 33/40] kernel/bpf/verifier.c:12762:17-18: WARNING opportunity for max() kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.