drivers/staging/wilc1000/mon.c:232:2: warning: 'strncpy' specified bound 16 equals destination size

From: kernel test robot
Date: Sun Jun 07 2020 - 15:15:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3b69e8b4571125bec1f77f886174fe6cab6b9d75
commit: 6cecbb2c67598db47eac301a5fe09e1bb380a08d staging: wilc1000: remove 'wilc_' prefix from filenames
date: 7 months ago
config: microblaze-randconfig-r014-20200607 (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
git checkout 6cecbb2c67598db47eac301a5fe09e1bb380a08d
# 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 >>, old ones prefixed by <<):

drivers/staging/wilc1000/mon.c: In function 'wilc_wfi_init_mon_interface':
>> drivers/staging/wilc1000/mon.c:232:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
232 | strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +232 drivers/staging/wilc1000/mon.c

c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 216
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 217 struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 218 const char *name,
1b7c69e84bcea7 drivers/staging/wilc1000/linux_mon.c Anchal Jain 2016-03-14 219 struct net_device *real_dev)
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 220 {
73d359a08b76da drivers/staging/wilc1000/linux_mon.c Ajay Singh 2018-05-02 221 struct wilc_wfi_mon_priv *priv;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 222
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 223 /*If monitor interface is already initialized, return it*/
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 224 if (wl->monitor_dev)
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 225 return wl->monitor_dev;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 226
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 227 wl->monitor_dev = alloc_etherdev(sizeof(struct wilc_wfi_mon_priv));
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 228 if (!wl->monitor_dev)
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 229 return NULL;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 230
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 231 wl->monitor_dev->type = ARPHRD_IEEE80211_RADIOTAP;
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 @232 strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 233 wl->monitor_dev->name[IFNAMSIZ - 1] = 0;
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 234 wl->monitor_dev->netdev_ops = &wilc_wfi_netdev_ops;
9bc061e8805487 drivers/staging/wilc1000/wilc_mon.c Ajay Singh 2019-06-26 235 wl->monitor_dev->needs_free_netdev = true;
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 236
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 237 if (register_netdevice(wl->monitor_dev)) {
d892c97c889a77 drivers/staging/wilc1000/linux_mon.c Leo Kim 2016-02-22 238 netdev_err(real_dev, "register_netdevice failed\n");
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 239 return NULL;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 240 }
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 241 priv = netdev_priv(wl->monitor_dev);
60959e53f83988 drivers/staging/wilc1000/linux_mon.c Leo Kim 2016-02-22 242 if (!priv)
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 243 return NULL;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 244
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 245 priv->real_ndev = real_dev;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 246
588713006ea49d drivers/staging/wilc1000/linux_mon.c Ajay Singh 2019-02-02 247 return wl->monitor_dev;
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 248 }
c5c77ba18ea66a drivers/staging/wilc1000/linux_mon.c Johnny Kim 2015-05-11 249

:::::: The code at line 232 was first introduced by commit
:::::: 588713006ea49d63d4e01aa147e9e3dcb130c783 staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable

:::::: TO: Ajay Singh <ajay.kathat@xxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip