Re: [PATCH v2 2/2] kfence: allow change number of object by early parameter

From: kernel test robot

Date: Sat Dec 20 2025 - 10:00:15 EST


Hi yuan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on drm-misc/drm-misc-next linus/master v6.19-rc1 next-20251219]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/yuan-linyu/LoongArch-kfence-avoid-use-CONFIG_KFENCE_NUM_OBJECTS/20251218-144322
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20251218063916.1433615-3-yuanlinyu%40honor.com
patch subject: [PATCH v2 2/2] kfence: allow change number of object by early parameter
config: i386-buildonly-randconfig-001-20251219 (https://download.01.org/0day-ci/archive/20251220/202512202213.aA8qY41g-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251220/202512202213.aA8qY41g-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/202512202213.aA8qY41g-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> mm/kfence/core.c:997:16: warning: variable 'nr_pages_covered' set but not used [-Wunused-but-set-variable]
997 | unsigned long nr_pages_covered, covered_size;
| ^
1 warning generated.


vim +/nr_pages_covered +997 mm/kfence/core.c

991
992 static int kfence_init_late(void)
993 {
994 unsigned long nr_pages_meta = KFENCE_METADATA_SIZE / PAGE_SIZE;
995 unsigned long addr = (unsigned long)__kfence_pool;
996 unsigned long free_size = __kfence_pool_size;
> 997 unsigned long nr_pages_covered, covered_size;
998 int err = -ENOMEM;
999
1000 kfence_alloc_covered_order = ilog2(__kfence_num_objects) + 2;
1001 kfence_alloc_covered_mask = (1 << kfence_alloc_covered_order) - 1;
1002 covered_size = PAGE_ALIGN(KFENCE_COVERED_SIZE);
1003 nr_pages_covered = (covered_size / PAGE_SIZE);
1004 #ifdef CONFIG_CONTIG_ALLOC
1005 struct page *pages;
1006
1007 pages = alloc_contig_pages(__kfence_pool_pages, GFP_KERNEL, first_online_node,
1008 NULL);
1009 if (!pages)
1010 return -ENOMEM;
1011
1012 __kfence_pool = page_to_virt(pages);
1013 pages = alloc_contig_pages(nr_pages_covered, GFP_KERNEL, first_online_node,
1014 NULL);
1015 if (!pages)
1016 goto free_pool;
1017 alloc_covered = page_to_virt(pages);
1018 pages = alloc_contig_pages(nr_pages_meta, GFP_KERNEL, first_online_node,
1019 NULL);
1020 if (pages)
1021 kfence_metadata_init = page_to_virt(pages);
1022 #else
1023 if (__kfence_pool_pages > MAX_ORDER_NR_PAGES ||
1024 nr_pages_meta > MAX_ORDER_NR_PAGES) {
1025 pr_warn("KFENCE_NUM_OBJECTS too large for buddy allocator\n");
1026 return -EINVAL;
1027 }
1028
1029 __kfence_pool = alloc_pages_exact(__kfence_pool_size, GFP_KERNEL);
1030 if (!__kfence_pool)
1031 return -ENOMEM;
1032
1033 alloc_covered = alloc_pages_exact(covered_size, GFP_KERNEL);
1034 if (!alloc_covered)
1035 goto free_pool;
1036 kfence_metadata_init = alloc_pages_exact(KFENCE_METADATA_SIZE, GFP_KERNEL);
1037 #endif
1038
1039 if (!kfence_metadata_init)
1040 goto free_cover;
1041
1042 memzero_explicit(kfence_metadata_init, KFENCE_METADATA_SIZE);
1043 addr = kfence_init_pool();
1044 if (!addr) {
1045 kfence_init_enable();
1046 kfence_debugfs_init();
1047 return 0;
1048 }
1049
1050 pr_err("%s failed\n", __func__);
1051 free_size = __kfence_pool_size - (addr - (unsigned long)__kfence_pool);
1052 err = -EBUSY;
1053

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