kernel/bpf/kmem_cache_iter.c:25:1: warning: 'retain' attribute ignored

From: kernel test robot
Date: Tue Mar 18 2025 - 03:17:51 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 76b6905c11fd3c6dc4562aefc3e8c4429fefae1e
commit: 2e9a548009c2d804e55cdd5b0e9903756cf7d9b3 bpf: Add open coded version of kmem_cache iterator
date: 5 months ago
config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20250318/202503181537.syuSFzVo-lkp@xxxxxxxxx/config)
compiler: mips-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250318/202503181537.syuSFzVo-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/202503181537.syuSFzVo-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/bpf/kmem_cache_iter.c:25:1: warning: 'retain' attribute ignored [-Wattributes]
25 | {
| ^
kernel/bpf/kmem_cache_iter.c:36:1: warning: 'retain' attribute ignored [-Wattributes]
36 | {
| ^
kernel/bpf/kmem_cache_iter.c:81:1: warning: 'retain' attribute ignored [-Wattributes]
81 | {
| ^

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]


vim +/retain +25 kernel/bpf/kmem_cache_iter.c

23
24 __bpf_kfunc int bpf_iter_kmem_cache_new(struct bpf_iter_kmem_cache *it)
> 25 {
26 struct bpf_iter_kmem_cache_kern *kit = (void *)it;
27
28 BUILD_BUG_ON(sizeof(*kit) > sizeof(*it));
29 BUILD_BUG_ON(__alignof__(*kit) != __alignof__(*it));
30
31 kit->pos = KMEM_CACHE_POS_START;
32 return 0;
33 }
34

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