drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2883:32: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 26
From: kernel test robot
Date: Sun Jan 12 2025 - 05:43:17 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b62cef9a5c673f1b8083159f5dc03c1c5daced2f
commit: 63185eb3aa267f2844580bbd8c9c1c97516f5dbb bnxt_en: Provide stored devlink "fw" version on older firmware
date: 3 years, 2 months ago
config: powerpc64-randconfig-002-20231105 (https://download.01.org/0day-ci/archive/20250112/202501121803.OAjkdvn9-lkp@xxxxxxxxx/config)
compiler: powerpc64-linux-gcc (GCC) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250112/202501121803.OAjkdvn9-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/202501121803.OAjkdvn9-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c: In function 'bnxt_ethtool_init':
>> drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2883:32: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 26 [-Wformat-truncation=]
2883 | "/pkg %s", buf);
| ^~ ~~~
In function 'bnxt_get_pkgver',
inlined from 'bnxt_ethtool_init' at drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:3723:3:
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c:2882:17: note: 'snprintf' output between 6 and 37 bytes into a destination of size 31
2882 | snprintf(bp->fw_ver_str + len, FW_VER_STR_LEN - len - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2883 | "/pkg %s", buf);
| ~~~~~~~~~~~~~~~
vim +2883 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
2873
2874 static void bnxt_get_pkgver(struct net_device *dev)
2875 {
2876 struct bnxt *bp = netdev_priv(dev);
2877 char buf[FW_VER_STR_LEN];
2878 int len;
2879
2880 if (!bnxt_get_pkginfo(dev, buf, sizeof(buf))) {
2881 len = strlen(bp->fw_ver_str);
2882 snprintf(bp->fw_ver_str + len, FW_VER_STR_LEN - len - 1,
> 2883 "/pkg %s", buf);
2884 }
2885 }
2886
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki