[PATCH v6 1/8] lib/string_kunit: add correctness test for strlen()

kernel test robot lkp at intel.com
Thu Jan 29 08:55:27 PST 2026


Hi Feng,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/hardening]
[also build test ERROR on akpm-mm/mm-nonmm-unstable akpm-mm/mm-everything linus/master v6.19-rc7 next-20260128]
[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/Feng-Jiang/lib-string_kunit-add-correctness-test-for-strlen/20260129-151036
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link:    https://lore.kernel.org/r/20260129070227.220866-2-jiangfeng%40kylinos.cn
patch subject: [PATCH v6 1/8] lib/string_kunit: add correctness test for strlen()
config: x86_64-randconfig-001-20260129 (https://download.01.org/0day-ci/archive/20260130/202601300014.gbv48Y5D-lkp@intel.com/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/20260130/202601300014.gbv48Y5D-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/202601300014.gbv48Y5D-lkp@intel.com/

All errors (new ones prefixed by >>):

>> lib/tests/string_kunit.c:116:13: error: call to undeclared function 'PAGE_ALIGN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     116 |         buf_size = PAGE_ALIGN(STRING_TEST_MAX_LEN + STRING_TEST_MAX_OFFSET + 1);
         |                    ^
   1 error generated.


vim +/PAGE_ALIGN +116 lib/tests/string_kunit.c

   110	
   111	static void string_test_strlen(struct kunit *test)
   112	{
   113		size_t buf_size;
   114		char *buf, *s;
   115	
 > 116		buf_size = PAGE_ALIGN(STRING_TEST_MAX_LEN + STRING_TEST_MAX_OFFSET + 1);
   117		buf = vmalloc(buf_size);
   118		KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buf);
   119	
   120		memset(buf, 'A', buf_size);
   121	
   122		for (size_t offset = 0; offset < STRING_TEST_MAX_OFFSET; offset++) {
   123			for (size_t len = 0; len <= STRING_TEST_MAX_LEN; len++) {
   124				s = buf + buf_size - 1 - offset - len;
   125				s[len] = '\0';
   126				KUNIT_EXPECT_EQ_MSG(test, strlen(s), len,
   127					"offset:%zu len:%zu", offset, len);
   128				s[len] = 'A';
   129			}
   130		}
   131	
   132		vfree(buf);
   133	}
   134	

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



More information about the linux-riscv mailing list