[openeuler:OLK-6.6 2455/2455] drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c:1268:29: warning: 'speed ' directive output may be truncated writing 6 bytes into a region of size between 1 and 128

tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 9b85bcf0e6357841885264f42859bec05c9073f4 commit: 0bf0c942a09ba92e1d22e6960464b628dd4408fa [2455/2455] net/hinic3: Synchronize new NIC features and bug fixes config: x86_64-buildonly-randconfig-006-20250704 (https://download.01.org/0day-ci/archive/20250704/202507040829.NhLVmauM-lkp@i...) compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250704/202507040829.NhLVmauM-lkp@i...) 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@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202507040829.NhLVmauM-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c:356:5: warning: no previous prototype for 'hinic3_rx_queue_stat_pack' [-Wmissing-prototypes] 356 | int hinic3_rx_queue_stat_pack(struct hinic3_show_item *item, | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c:369:5: warning: no previous prototype for 'hinic3_tx_queue_stat_pack' [-Wmissing-prototypes] 369 | int hinic3_tx_queue_stat_pack(struct hinic3_show_item *item, | ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c: In function 'hinic3_set_settings_to_hw':
drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c:1268:29: warning: 'speed ' directive output may be truncated writing 6 bytes into a region of size between 1 and 128 [-Wformat-truncation=] 1268 | "%sspeed %u ", link_info, speed); | ^~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c:1267:17: note: 'snprintf' output between 9 and 145 bytes into a destination of size 128 1267 | snprintf(set_link_str, sizeof(set_link_str), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1268 | "%sspeed %u ", link_info, speed); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:621:6: warning: no previous prototype for 'print_port_info' [-Wmissing-prototypes] 621 | void print_port_info(struct hinic3_nic_io *nic_io, | ^~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:803:6: warning: no previous prototype for 'hinic3_notify_vf_bond_status' [-Wmissing-prototypes] 803 | void hinic3_notify_vf_bond_status(struct hinic3_nic_io *nic_io, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:833:6: warning: no previous prototype for 'hinic3_notify_all_vfs_bond_changed' [-Wmissing-prototypes] 833 | void hinic3_notify_all_vfs_bond_changed(void *hwdev, u8 bond_status) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:1671:5: warning: no previous prototype for 'set_fecparam' [-Wmissing-prototypes] 1671 | int set_fecparam(void *hwdev, u8 fecparam) | ^~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:1699:5: warning: no previous prototype for 'get_fecparam' [-Wmissing-prototypes] 1699 | int get_fecparam(void *hwdev, u8 *advertised_fec, u8 *supported_fec) | ^~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c: In function 'get_port_temperature_power': drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:548:52: warning: ', rx power: ' directive output may be truncated writing 12 bytes into a region of size between 1 and 512 [-Wformat-truncation=] 548 | snprintf(str, CAP_INFO_MAX_LEN, "%s, rx power: %uuW, tx power: %uuW", | ^~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:548:17: note: 'snprintf' output between 31 and 560 bytes into a destination of size 512 548 | snprintf(str, CAP_INFO_MAX_LEN, "%s, rx power: %uuW, tx power: %uuW", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 549 | cap_info, info->power[0x0], info->power[0x1]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:544:53: warning: ', rx power: ' directive output may be truncated writing 12 bytes into a region of size between 1 and 512 [-Wformat-truncation=] 544 | snprintf(str, CAP_INFO_MAX_LEN, "%s, rx power: %uuw %uuW %uuW %uuW", | ^~~~~~~~~~~~ drivers/net/ethernet/huawei/hinic3/hinic3_mag_cfg.c:544:17: note: 'snprintf' output between 28 and 575 bytes into a destination of size 512 544 | snprintf(str, CAP_INFO_MAX_LEN, "%s, rx power: %uuw %uuW %uuW %uuW", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 545 | cap_info, info->power[0x0], info->power[0x1], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 546 | info->power[0x2], info->power[0x3]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1268 drivers/net/ethernet/huawei/hinic3/hinic3_ethtool_stats.c 1250 1251 static int hinic3_set_settings_to_hw(struct hinic3_nic_dev *nic_dev, 1252 u32 set_settings, u8 autoneg, u32 speed) 1253 { 1254 struct net_device *netdev = nic_dev->netdev; 1255 struct hinic3_link_ksettings settings = { 0 }; 1256 int speed_level = 0; 1257 char set_link_str[HINIC_SET_LINK_STR_LEN] = {0}; 1258 char link_info[HINIC_SET_LINK_STR_LEN] = {0}; 1259 int err = 0; 1260 1261 snprintf(link_info, sizeof(link_info), "%s", 1262 (bool)(set_settings & HILINK_LINK_SET_AUTONEG) ? 1263 ((bool)autoneg ? "autong enable " : "autong disable ") : ""); 1264 1265 if (set_settings & HILINK_LINK_SET_SPEED) { 1266 speed_level = hinic3_ethtool_to_hw_speed_level(speed); 1267 snprintf(set_link_str, sizeof(set_link_str),
1268 "%sspeed %u ", link_info, speed); 1269 } 1270 1271 settings.valid_bitmap = set_settings; 1272 settings.autoneg = (bool)autoneg ? PORT_CFG_AN_ON : PORT_CFG_AN_OFF; 1273 settings.speed = (u8)speed_level; 1274 1275 err = hinic3_set_link_settings(nic_dev->hwdev, &settings); 1276 if (err) 1277 nicif_err(nic_dev, drv, netdev, "Set %sfailed\n", set_link_str); 1278 else 1279 nicif_info(nic_dev, drv, netdev, "Set %ssuccess\n", 1280 set_link_str); 1281 1282 return err; 1283 } 1284
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
participants (1)
-
kernel test robot