Re: [PATCH] kunit: add unit test for filtering suites by names

From: kernel test robot
Date: Tue Apr 13 2021 - 02:54:33 EST


Hi Daniel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 1678e493d530e7977cce34e59a86bb86f3c5631e]

url: https://github.com/0day-ci/linux/commits/Daniel-Latypov/kunit-add-unit-test-for-filtering-suites-by-names/20210413-080913
base: 1678e493d530e7977cce34e59a86bb86f3c5631e
config: microblaze-randconfig-r014-20210413 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/756df216f1586cecdf02f278fbed232fb25fa3f7
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Latypov/kunit-add-unit-test-for-filtering-suites-by-names/20210413-080913
git checkout 756df216f1586cecdf02f278fbed232fb25fa3f7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from lib/kunit/executor.c:119:
lib/kunit/executor_test.c: In function 'alloc_fake_suite':
>> lib/kunit/executor_test.c:129:2: warning: 'strncpy' specified bound 256 equals destination size [-Wstringop-truncation]
129 | strncpy((char *)suite->name, suite_name, sizeof(suite->name));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +129 lib/kunit/executor_test.c

121
122 static struct kunit_suite *alloc_fake_suite(struct kunit *test,
123 const char *suite_name)
124 {
125 struct kunit_suite *suite;
126
127 /* We normally never expect to allocate suites, hence the non-const cast. */
128 suite = kunit_kzalloc(test, sizeof(*suite), GFP_KERNEL);
> 129 strncpy((char *)suite->name, suite_name, sizeof(suite->name));

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip