drivers/s390/net/qeth_core_main.c:6194:9: warning: 'strncpy' specified bound 20 equals destination size
From: kernel test robot
Date: Thu Jan 13 2022 - 13:35:04 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 455e73a07f6e288b0061dfcf4fcf54fa9fe06458
commit: 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e init/Kconfig: make COMPILE_TEST depend on !S390
date: 1 year, 2 months ago
config: s390-randconfig-r016-20220113 (https://download.01.org/0day-ci/archive/20220114/202201140208.SgphJJdy-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.2.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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=334ef6ed06fa1a54e35296b77b693bcf6d63ee9e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
drivers/s390/net/qeth_core_main.c: In function 'qeth_dbf_longtext':
drivers/s390/net/qeth_core_main.c:6066:9: warning: function 'qeth_dbf_longtext' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
6066 | vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args);
| ^~~~~~~~~
drivers/s390/net/qeth_core_main.c: In function 'qeth_add_dbf_entry':
>> drivers/s390/net/qeth_core_main.c:6194:9: warning: 'strncpy' specified bound 20 equals destination size [-Wstringop-truncation]
6194 | strncpy(new_entry->dbf_name, name, DBF_NAME_LEN);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +6194 drivers/s390/net/qeth_core_main.c
819dc537fd7fcd Stefan Raspl 2013-01-21 6179
819dc537fd7fcd Stefan Raspl 2013-01-21 6180 static int qeth_add_dbf_entry(struct qeth_card *card, char *name)
819dc537fd7fcd Stefan Raspl 2013-01-21 6181 {
819dc537fd7fcd Stefan Raspl 2013-01-21 6182 struct qeth_dbf_entry *new_entry;
819dc537fd7fcd Stefan Raspl 2013-01-21 6183
819dc537fd7fcd Stefan Raspl 2013-01-21 6184 card->debug = debug_register(name, 2, 1, 8);
819dc537fd7fcd Stefan Raspl 2013-01-21 6185 if (!card->debug) {
819dc537fd7fcd Stefan Raspl 2013-01-21 6186 QETH_DBF_TEXT_(SETUP, 2, "%s", "qcdbf");
819dc537fd7fcd Stefan Raspl 2013-01-21 6187 goto err;
819dc537fd7fcd Stefan Raspl 2013-01-21 6188 }
819dc537fd7fcd Stefan Raspl 2013-01-21 6189 if (debug_register_view(card->debug, &debug_hex_ascii_view))
819dc537fd7fcd Stefan Raspl 2013-01-21 6190 goto err_dbg;
819dc537fd7fcd Stefan Raspl 2013-01-21 6191 new_entry = kzalloc(sizeof(struct qeth_dbf_entry), GFP_KERNEL);
819dc537fd7fcd Stefan Raspl 2013-01-21 6192 if (!new_entry)
819dc537fd7fcd Stefan Raspl 2013-01-21 6193 goto err_dbg;
819dc537fd7fcd Stefan Raspl 2013-01-21 @6194 strncpy(new_entry->dbf_name, name, DBF_NAME_LEN);
819dc537fd7fcd Stefan Raspl 2013-01-21 6195 new_entry->dbf_info = card->debug;
819dc537fd7fcd Stefan Raspl 2013-01-21 6196 mutex_lock(&qeth_dbf_list_mutex);
819dc537fd7fcd Stefan Raspl 2013-01-21 6197 list_add(&new_entry->dbf_list, &qeth_dbf_list);
819dc537fd7fcd Stefan Raspl 2013-01-21 6198 mutex_unlock(&qeth_dbf_list_mutex);
819dc537fd7fcd Stefan Raspl 2013-01-21 6199
819dc537fd7fcd Stefan Raspl 2013-01-21 6200 return 0;
819dc537fd7fcd Stefan Raspl 2013-01-21 6201
819dc537fd7fcd Stefan Raspl 2013-01-21 6202 err_dbg:
819dc537fd7fcd Stefan Raspl 2013-01-21 6203 debug_unregister(card->debug);
819dc537fd7fcd Stefan Raspl 2013-01-21 6204 err:
819dc537fd7fcd Stefan Raspl 2013-01-21 6205 return -ENOMEM;
819dc537fd7fcd Stefan Raspl 2013-01-21 6206 }
819dc537fd7fcd Stefan Raspl 2013-01-21 6207
:::::: The code at line 6194 was first introduced by commit
:::::: 819dc537fd7fcd799c5f7f85693d29e2635a84f9 qeth: Make s390dbf card entries persistent
:::::: TO: Stefan Raspl <raspl@xxxxxxxxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx