* [PATCH iwl-next v1 0/2] intel: format specifier cleanups
@ 2023-10-03 18:36 Jesse Brandeburg
2023-10-03 18:36 ` [PATCH iwl-next v1 1/2] intel: fix string truncation warnings Jesse Brandeburg
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jesse Brandeburg @ 2023-10-03 18:36 UTC (permalink / raw)
To: intel-wired-lan
Cc: Jesse Brandeburg, netdev, Christophe JAILLET, Przemek Kitszel
Clean up some warnings from the W=1 build which moves the intel
directory back to "clean" state. This mostly involved converting to
using ethtool_sprintf where appropriate and kasprintf in other places.
The second patch goes the extra mile and cleans up -Wformat=2 warnings
as suggested by Alex Lobakin, since those flags will likely be turned on
as well.
gcc-12 runs clean after these changes, and clang-15 still has some minor
complaints as mentioned in patch-2.
Jesse Brandeburg (2):
intel: fix string truncation warnings
intel: fix format warnings
.../net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++-
.../net/ethernet/intel/iavf/iavf_ethtool.c | 8 ++--
.../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++--
drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +-
drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 ++-
.../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 +-
9 files changed, 46 insertions(+), 51 deletions(-)
base-commit: e643597346c72ebb961ee79ebec34acc042e8ac2
--
2.39.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH iwl-next v1 1/2] intel: fix string truncation warnings
2023-10-03 18:36 [PATCH iwl-next v1 0/2] intel: format specifier cleanups Jesse Brandeburg
@ 2023-10-03 18:36 ` Jesse Brandeburg
2023-10-12 10:12 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-10-03 18:36 ` [PATCH iwl-next v1 2/2] intel: fix format warnings Jesse Brandeburg
2023-10-04 13:45 ` [PATCH iwl-next v1 0/2] intel: format specifier cleanups Simon Horman
2 siblings, 1 reply; 9+ messages in thread
From: Jesse Brandeburg @ 2023-10-03 18:36 UTC (permalink / raw)
To: intel-wired-lan
Cc: Jesse Brandeburg, netdev, Christophe JAILLET, Przemek Kitszel,
Alexander Lobakin
Fix -Wformat-truncated warnings to complete the intel directories' W=1
clean efforts. The W=1 recently got enhanced with a few new flags and
this brought up some new warnings.
Switch to using kasprintf() when possible so we always allocate the
right length strings.
summary of warnings:
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
I thought this was fine to go to -next since there isn't really urgency
to drive this change.
---
/linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c: In function ‘iavf_virtchnl_completion’:
/linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
1425 | snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
| ^~
1426 | link_speed_mbps, "Mbps");
| ~~~~~~
/linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
1425 | snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1426 | link_speed_mbps, "Mbps");
| ~~~~~~~~~~~~~~~~~~~~~~~~
/linux/drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_get_sma_config_e810t’:
/linux/drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
43 | "%s", ice_pin_desc_e810t[i].name);
| ^~
/linux/drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
42 | snprintf(ptp_pins[i].name, sizeof(ptp_pins[i].name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 | "%s", ice_pin_desc_e810t[i].name);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/linux/drivers/net/ethernet/intel/igb/igb_main.c: In function ‘igb_set_fw_version’:
/linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
3092 | "%d.%d, 0x%08x, %d.%d.%d",
| ^~
/linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
3092 | "%d.%d, 0x%08x, %d.%d.%d",
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
/linux/drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
3090 | snprintf(adapter->fw_version,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3091 | sizeof(adapter->fw_version),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3092 | "%d.%d, 0x%08x, %d.%d.%d",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
3093 | fw.eep_major, fw.eep_minor, fw.etrack_id,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3094 | fw.or_major, fw.or_build, fw.or_patch);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
.../net/ethernet/intel/iavf/iavf_ethtool.c | 4 +-
.../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
4 files changed, 30 insertions(+), 37 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 90397293525f..9246172c9c33 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -396,8 +396,8 @@ static void iavf_get_priv_flag_strings(struct net_device *netdev, u8 *data)
unsigned int i;
for (i = 0; i < IAVF_PRIV_FLAGS_STR_LEN; i++) {
- snprintf(data, ETH_GSTRING_LEN, "%s",
- iavf_gstrings_priv_flags[i].flag_string);
+ strscpy(data, iavf_gstrings_priv_flags[i].flag_string,
+ ETH_GSTRING_LEN);
data += ETH_GSTRING_LEN;
}
}
diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
index 8ce6389b5815..82b84a93bcc8 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
@@ -1378,8 +1378,6 @@ void iavf_disable_vlan_insertion_v2(struct iavf_adapter *adapter, u16 tpid)
VIRTCHNL_OP_DISABLE_VLAN_INSERTION_V2);
}
-#define IAVF_MAX_SPEED_STRLEN 13
-
/**
* iavf_print_link_message - print link up or down
* @adapter: adapter structure
@@ -1397,10 +1395,6 @@ static void iavf_print_link_message(struct iavf_adapter *adapter)
return;
}
- speed = kzalloc(IAVF_MAX_SPEED_STRLEN, GFP_KERNEL);
- if (!speed)
- return;
-
if (ADV_LINK_SUPPORT(adapter)) {
link_speed_mbps = adapter->link_speed_mbps;
goto print_link_msg;
@@ -1438,17 +1432,17 @@ static void iavf_print_link_message(struct iavf_adapter *adapter)
print_link_msg:
if (link_speed_mbps > SPEED_1000) {
- if (link_speed_mbps == SPEED_2500)
- snprintf(speed, IAVF_MAX_SPEED_STRLEN, "2.5 Gbps");
- else
+ if (link_speed_mbps == SPEED_2500) {
+ speed = kasprintf(GFP_KERNEL, "%s", "2.5 Gbps");
+ } else {
/* convert to Gbps inline */
- snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
- link_speed_mbps / 1000, "Gbps");
+ speed = kasprintf(GFP_KERNEL, "%d Gbps",
+ link_speed_mbps / 1000);
+ }
} else if (link_speed_mbps == SPEED_UNKNOWN) {
- snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%s", "Unknown Mbps");
+ speed = kasprintf(GFP_KERNEL, "%s", "Unknown Mbps");
} else {
- snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
- link_speed_mbps, "Mbps");
+ speed = kasprintf(GFP_KERNEL, "%d Mbps", link_speed_mbps);
}
netdev_info(netdev, "NIC Link is Up Speed is %s Full Duplex\n", speed);
diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 5293df2d57a8..1eddcbe89b0c 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -39,8 +39,8 @@ ice_get_sma_config_e810t(struct ice_hw *hw, struct ptp_pin_desc *ptp_pins)
/* initialize with defaults */
for (i = 0; i < NUM_PTP_PINS_E810T; i++) {
- snprintf(ptp_pins[i].name, sizeof(ptp_pins[i].name),
- "%s", ice_pin_desc_e810t[i].name);
+ strscpy(ptp_pins[i].name, ice_pin_desc_e810t[i].name,
+ sizeof(ptp_pins[i].name));
ptp_pins[i].index = ice_pin_desc_e810t[i].index;
ptp_pins[i].func = ice_pin_desc_e810t[i].func;
ptp_pins[i].chan = ice_pin_desc_e810t[i].chan;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 2ac9dffd0bf8..fdadf3e84f59 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -3069,6 +3069,7 @@ void igb_set_fw_version(struct igb_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct e1000_fw_version fw;
+ char *lbuf;
igb_get_fw_version(hw, &fw);
@@ -3076,36 +3077,34 @@ void igb_set_fw_version(struct igb_adapter *adapter)
case e1000_i210:
case e1000_i211:
if (!(igb_get_flash_presence_i210(hw))) {
- snprintf(adapter->fw_version,
- sizeof(adapter->fw_version),
- "%2d.%2d-%d",
- fw.invm_major, fw.invm_minor,
- fw.invm_img_type);
+ lbuf = kasprintf(GFP_KERNEL, "%2d.%2d-%d",
+ fw.invm_major, fw.invm_minor,
+ fw.invm_img_type);
break;
}
fallthrough;
default:
- /* if option is rom valid, display its version too */
+ /* if option rom is valid, display its version too */
if (fw.or_valid) {
- snprintf(adapter->fw_version,
- sizeof(adapter->fw_version),
- "%d.%d, 0x%08x, %d.%d.%d",
- fw.eep_major, fw.eep_minor, fw.etrack_id,
- fw.or_major, fw.or_build, fw.or_patch);
+ lbuf = kasprintf(GFP_KERNEL, "%d.%d, 0x%08x, %d.%d.%d",
+ fw.eep_major, fw.eep_minor,
+ fw.etrack_id, fw.or_major, fw.or_build,
+ fw.or_patch);
/* no option rom */
} else if (fw.etrack_id != 0X0000) {
- snprintf(adapter->fw_version,
- sizeof(adapter->fw_version),
- "%d.%d, 0x%08x",
- fw.eep_major, fw.eep_minor, fw.etrack_id);
+ lbuf = kasprintf(GFP_KERNEL, "%d.%d, 0x%08x",
+ fw.eep_major, fw.eep_minor,
+ fw.etrack_id);
} else {
- snprintf(adapter->fw_version,
- sizeof(adapter->fw_version),
- "%d.%d.%d",
- fw.eep_major, fw.eep_minor, fw.eep_build);
+ lbuf = kasprintf(GFP_KERNEL, "%d.%d.%d", fw.eep_major,
+ fw.eep_minor, fw.eep_build);
}
break;
}
+
+ /* the truncate happens here if it doesn't fit */
+ strscpy(adapter->fw_version, lbuf, sizeof(adapter->fw_version));
+ kfree(lbuf);
}
/**
base-commit: e643597346c72ebb961ee79ebec34acc042e8ac2
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH iwl-next v1 2/2] intel: fix format warnings
2023-10-03 18:36 [PATCH iwl-next v1 0/2] intel: format specifier cleanups Jesse Brandeburg
2023-10-03 18:36 ` [PATCH iwl-next v1 1/2] intel: fix string truncation warnings Jesse Brandeburg
@ 2023-10-03 18:36 ` Jesse Brandeburg
2023-10-12 10:12 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-10-12 10:13 ` Pucha, HimasekharX Reddy
2023-10-04 13:45 ` [PATCH iwl-next v1 0/2] intel: format specifier cleanups Simon Horman
2 siblings, 2 replies; 9+ messages in thread
From: Jesse Brandeburg @ 2023-10-03 18:36 UTC (permalink / raw)
To: intel-wired-lan
Cc: Jesse Brandeburg, netdev, Christophe JAILLET, Przemek Kitszel,
Alexander Lobakin
Get ahead of the game and fix all the -Wformat=2 noted warnings in the
intel drivers directory.
There are one set of i40e and iavf warnings I couldn't figure out how to
fix because the driver is already using vsnprintf without an explicit
"const char *" format string.
Tested with both gcc-12 and clang-15. I found gcc-12 runs clean after
this series but clang-15 is a little worried about the vsnprintf lines.
summary of warnings:
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
clang-15 warnings before the patch:
drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
^~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
^
"%s",
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ixgbe_gstrings_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
ixgbe_gstrings_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
igc_gstrings_net_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
igc_gstrings_net_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
igb_gstrings_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
igb_gstrings_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
igb_gstrings_net_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
igb_gstrings_net_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
^~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
^
"%s",
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
^
"%s",
drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ice_gstrings_vsi_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
ice_gstrings_vsi_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ice_gstrings_pf_stats[i].stat_string);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
ice_gstrings_pf_stats[i].stat_string);
^
"%s",
drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
^
"%s",
---
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++++--
drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 8 +++-----
drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++++---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ++--
drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 +++--
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++--
6 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index bd1321bf7e26..1d57225eeefc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -2512,11 +2512,13 @@ static void i40e_get_priv_flag_strings(struct net_device *netdev, u8 *data)
u8 *p = data;
for (i = 0; i < I40E_PRIV_FLAGS_STR_LEN; i++)
- ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
+ ethtool_sprintf(&p, "%s",
+ i40e_gstrings_priv_flags[i].flag_string);
if (pf->hw.pf_id != 0)
return;
for (i = 0; i < I40E_GL_PRIV_FLAGS_STR_LEN; i++)
- ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
+ ethtool_sprintf(&p, "%s",
+ i40e_gl_gstrings_priv_flags[i].flag_string);
}
static void i40e_get_strings(struct net_device *netdev, u32 stringset,
diff --git a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
index 9246172c9c33..6f236d1a6444 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_ethtool.c
@@ -395,11 +395,9 @@ static void iavf_get_priv_flag_strings(struct net_device *netdev, u8 *data)
{
unsigned int i;
- for (i = 0; i < IAVF_PRIV_FLAGS_STR_LEN; i++) {
- strscpy(data, iavf_gstrings_priv_flags[i].flag_string,
- ETH_GSTRING_LEN);
- data += ETH_GSTRING_LEN;
- }
+ for (i = 0; i < IAVF_PRIV_FLAGS_STR_LEN; i++)
+ ethtool_sprintf(&data, "%s",
+ iavf_gstrings_priv_flags[i].flag_string);
}
/**
diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
index d3cb08e66dcb..5545906f39af 100644
--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
@@ -1060,7 +1060,7 @@ __ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data,
switch (stringset) {
case ETH_SS_STATS:
for (i = 0; i < ICE_VSI_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
ice_gstrings_vsi_stats[i].stat_string);
if (ice_is_port_repr_netdev(netdev))
@@ -1080,7 +1080,7 @@ __ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data,
return;
for (i = 0; i < ICE_PF_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
ice_gstrings_pf_stats[i].stat_string);
for (i = 0; i < ICE_MAX_USER_PRIORITY; i++) {
@@ -1097,7 +1097,8 @@ __ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data,
break;
case ETH_SS_PRIV_FLAGS:
for (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++)
- ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
+ ethtool_sprintf(&p, "%s",
+ ice_gstrings_priv_flags[i].name);
break;
default:
break;
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index 319ed601eaa1..9cbd35b6df43 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2356,10 +2356,10 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
break;
case ETH_SS_STATS:
for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
igb_gstrings_stats[i].stat_string);
for (i = 0; i < IGB_NETDEV_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
igb_gstrings_net_stats[i].stat_string);
for (i = 0; i < adapter->num_tx_queues; i++) {
ethtool_sprintf(&p, "tx_queue_%u_packets", i);
diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index 7ab6dd58e400..bf4f611286ae 100644
--- a/drivers/net/ethernet/intel/igc/igc_ethtool.c
+++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c
@@ -773,9 +773,10 @@ static void igc_ethtool_get_strings(struct net_device *netdev, u32 stringset,
break;
case ETH_SS_STATS:
for (i = 0; i < IGC_GLOBAL_STATS_LEN; i++)
- ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
+ ethtool_sprintf(&p, "%s",
+ igc_gstrings_stats[i].stat_string);
for (i = 0; i < IGC_NETDEV_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
igc_gstrings_net_stats[i].stat_string);
for (i = 0; i < adapter->num_tx_queues; i++) {
ethtool_sprintf(&p, "tx_queue_%u_packets", i);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index 0bbad4a5cc2f..4dd897806fa5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -1413,11 +1413,11 @@ static void ixgbe_get_strings(struct net_device *netdev, u32 stringset,
switch (stringset) {
case ETH_SS_TEST:
for (i = 0; i < IXGBE_TEST_LEN; i++)
- ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
+ ethtool_sprintf(&p, "%s", ixgbe_gstrings_test[i]);
break;
case ETH_SS_STATS:
for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++)
- ethtool_sprintf(&p,
+ ethtool_sprintf(&p, "%s",
ixgbe_gstrings_stats[i].stat_string);
for (i = 0; i < netdev->num_tx_queues; i++) {
ethtool_sprintf(&p, "tx_queue_%u_packets", i);
--
2.39.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH iwl-next v1 0/2] intel: format specifier cleanups
2023-10-03 18:36 [PATCH iwl-next v1 0/2] intel: format specifier cleanups Jesse Brandeburg
2023-10-03 18:36 ` [PATCH iwl-next v1 1/2] intel: fix string truncation warnings Jesse Brandeburg
2023-10-03 18:36 ` [PATCH iwl-next v1 2/2] intel: fix format warnings Jesse Brandeburg
@ 2023-10-04 13:45 ` Simon Horman
2023-10-06 15:16 ` [Intel-wired-lan] " Romanowski, Rafal
2 siblings, 1 reply; 9+ messages in thread
From: Simon Horman @ 2023-10-04 13:45 UTC (permalink / raw)
To: Jesse Brandeburg
Cc: intel-wired-lan, netdev, Christophe JAILLET, Przemek Kitszel
On Tue, Oct 03, 2023 at 11:36:01AM -0700, Jesse Brandeburg wrote:
> Clean up some warnings from the W=1 build which moves the intel
> directory back to "clean" state. This mostly involved converting to
> using ethtool_sprintf where appropriate and kasprintf in other places.
>
> The second patch goes the extra mile and cleans up -Wformat=2 warnings
> as suggested by Alex Lobakin, since those flags will likely be turned on
> as well.
>
> gcc-12 runs clean after these changes, and clang-15 still has some minor
> complaints as mentioned in patch-2.
>
> Jesse Brandeburg (2):
> intel: fix string truncation warnings
> intel: fix format warnings
>
> .../net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++-
> .../net/ethernet/intel/iavf/iavf_ethtool.c | 8 ++--
> .../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++--
> drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
> drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +-
> drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 ++-
> .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 +-
> 9 files changed, 46 insertions(+), 51 deletions(-)
For series,
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-next v1 0/2] intel: format specifier cleanups
2023-10-04 13:45 ` [PATCH iwl-next v1 0/2] intel: format specifier cleanups Simon Horman
@ 2023-10-06 15:16 ` Romanowski, Rafal
2023-10-09 10:50 ` Romanowski, Rafal
0 siblings, 1 reply; 9+ messages in thread
From: Romanowski, Rafal @ 2023-10-06 15:16 UTC (permalink / raw)
To: Simon Horman, Brandeburg, Jesse
Cc: netdev, Christophe JAILLET, intel-wired-lan, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Simon Horman
> Sent: Wednesday, October 4, 2023 3:46 PM
> To: Brandeburg, Jesse <jesse.brandeburg@intel.com>
> Cc: netdev@vger.kernel.org; Christophe JAILLET
> <christophe.jaillet@wanadoo.fr>; intel-wired-lan@lists.osuosl.org; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>
> Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 0/2] intel: format specifier
> cleanups
>
> On Tue, Oct 03, 2023 at 11:36:01AM -0700, Jesse Brandeburg wrote:
> > Clean up some warnings from the W=1 build which moves the intel
> > directory back to "clean" state. This mostly involved converting to
> > using ethtool_sprintf where appropriate and kasprintf in other places.
> >
> > The second patch goes the extra mile and cleans up -Wformat=2 warnings
> > as suggested by Alex Lobakin, since those flags will likely be turned
> > on as well.
> >
> > gcc-12 runs clean after these changes, and clang-15 still has some
> > minor complaints as mentioned in patch-2.
> >
> > Jesse Brandeburg (2):
> > intel: fix string truncation warnings
> > intel: fix format warnings
> >
> > .../net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++-
> > .../net/ethernet/intel/iavf/iavf_ethtool.c | 8 ++--
> > .../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
> > drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++--
> > drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
> > drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +-
> > drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
> > drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 ++-
> > .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 +-
> > 9 files changed, 46 insertions(+), 51 deletions(-)
>
> For series,
>
>
> Reviewed-by: Simon Horman <horms@kernel.org>
> Tested-by: Simon Horman <horms@kernel.org> # build-tested
>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-next v1 0/2] intel: format specifier cleanups
2023-10-06 15:16 ` [Intel-wired-lan] " Romanowski, Rafal
@ 2023-10-09 10:50 ` Romanowski, Rafal
0 siblings, 0 replies; 9+ messages in thread
From: Romanowski, Rafal @ 2023-10-09 10:50 UTC (permalink / raw)
To: Romanowski, Rafal, Simon Horman, Brandeburg, Jesse
Cc: netdev, intel-wired-lan, Christophe JAILLET, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Romanowski, Rafal
> Sent: Friday, October 6, 2023 5:16 PM
> To: Simon Horman <horms@kernel.org>; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>
> Cc: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org; Christophe
> JAILLET <christophe.jaillet@wanadoo.fr>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>
> Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 0/2] intel: format specifier
> cleanups
>
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> > Of Simon Horman
> > Sent: Wednesday, October 4, 2023 3:46 PM
> > To: Brandeburg, Jesse <jesse.brandeburg@intel.com>
> > Cc: netdev@vger.kernel.org; Christophe JAILLET
> > <christophe.jaillet@wanadoo.fr>; intel-wired-lan@lists.osuosl.org;
> > Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> > Subject: Re: [Intel-wired-lan] [PATCH iwl-next v1 0/2] intel: format
> > specifier cleanups
> >
> > On Tue, Oct 03, 2023 at 11:36:01AM -0700, Jesse Brandeburg wrote:
> > > Clean up some warnings from the W=1 build which moves the intel
> > > directory back to "clean" state. This mostly involved converting to
> > > using ethtool_sprintf where appropriate and kasprintf in other places.
> > >
> > > The second patch goes the extra mile and cleans up -Wformat=2
> > > warnings as suggested by Alex Lobakin, since those flags will likely
> > > be turned on as well.
> > >
> > > gcc-12 runs clean after these changes, and clang-15 still has some
> > > minor complaints as mentioned in patch-2.
> > >
> > > Jesse Brandeburg (2):
> > > intel: fix string truncation warnings
> > > intel: fix format warnings
> > >
> > > .../net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++-
> > > .../net/ethernet/intel/iavf/iavf_ethtool.c | 8 ++--
> > > .../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
> > > drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++--
> > > drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
> > > drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +-
> > > drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
> > > drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 ++-
> > > .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 +-
> > > 9 files changed, 46 insertions(+), 51 deletions(-)
> >
> > For series,
> >
> >
> > Reviewed-by: Simon Horman <horms@kernel.org>
> > Tested-by: Simon Horman <horms@kernel.org> # build-tested
> >
> > _______________________________________________
> > Intel-wired-lan mailing list
> > Intel-wired-lan@osuosl.org
> > https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
>
>
> Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
>
>
>
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-next v1 1/2] intel: fix string truncation warnings
2023-10-03 18:36 ` [PATCH iwl-next v1 1/2] intel: fix string truncation warnings Jesse Brandeburg
@ 2023-10-12 10:12 ` Pucha, HimasekharX Reddy
0 siblings, 0 replies; 9+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-10-12 10:12 UTC (permalink / raw)
To: Brandeburg, Jesse, intel-wired-lan
Cc: netdev, Lobakin, Aleksander, Christophe JAILLET, Brandeburg,
Jesse, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jesse Brandeburg
> Sent: Wednesday, October 4, 2023 12:06 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Lobakin, Aleksander <aleksander.lobakin@intel.com>; Christophe JAILLET <christophe.jaillet@wanadoo.fr>; Brandeburg, Jesse <jesse.brandeburg@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v1 1/2] intel: fix string truncation warnings
>
> Fix -Wformat-truncated warnings to complete the intel directories' W=1
> clean efforts. The W=1 recently got enhanced with a few new flags and
> this brought up some new warnings.
>
> Switch to using kasprintf() when possible so we always allocate the
> right length strings.
>
> summary of warnings:
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
> drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
> drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
> drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
> drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
>
> Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> I thought this was fine to go to -next since there isn't really urgency
> to drive this change.
> ---
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c: In function ‘iavf_virtchnl_completion’:
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
> 1425 | snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
> | ^~
> 1426 | link_speed_mbps, "Mbps");
> | ~~~~~~
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
> 1425 | snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1426 | link_speed_mbps, "Mbps");
> | ~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_get_sma_config_e810t’:
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
> 43 | "%s", ice_pin_desc_e810t[i].name);
> | ^~
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
> 42 | snprintf(ptp_pins[i].name, sizeof(ptp_pins[i].name),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 43 | "%s", ice_pin_desc_e810t[i].name);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c: In function ‘igb_set_fw_version’:
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
> 3092 | "%d.%d, 0x%08x, %d.%d.%d",
> | ^~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> 3092 | "%d.%d, 0x%08x, %d.%d.%d",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
> 3090 | snprintf(adapter->fw_version,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3091 | sizeof(adapter->fw_version),
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3092 | "%d.%d, 0x%08x, %d.%d.%d",
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3093 | fw.eep_major, fw.eep_minor, fw.etrack_id,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3094 | fw.or_major, fw.or_build, fw.or_patch);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
> .../net/ethernet/intel/iavf/iavf_ethtool.c | 4 +-
> .../net/ethernet/intel/iavf/iavf_virtchnl.c | 22 ++++-------
> drivers/net/ethernet/intel/ice/ice_ptp.c | 4 +-
> drivers/net/ethernet/intel/igb/igb_main.c | 37 +++++++++----------
> 4 files changed, 30 insertions(+), 37 deletions(-)
>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-next v1 2/2] intel: fix format warnings
2023-10-03 18:36 ` [PATCH iwl-next v1 2/2] intel: fix format warnings Jesse Brandeburg
@ 2023-10-12 10:12 ` Pucha, HimasekharX Reddy
2023-10-12 10:13 ` Pucha, HimasekharX Reddy
1 sibling, 0 replies; 9+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-10-12 10:12 UTC (permalink / raw)
To: Brandeburg, Jesse, intel-wired-lan
Cc: netdev, Lobakin, Aleksander, Christophe JAILLET, Brandeburg,
Jesse, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jesse Brandeburg
> Sent: Wednesday, October 4, 2023 12:06 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Lobakin, Aleksander <aleksander.lobakin@intel.com>; Christophe JAILLET <christophe.jaillet@wanadoo.fr>; Brandeburg, Jesse <jesse.brandeburg@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v1 2/2] intel: fix format warnings
>
> Get ahead of the game and fix all the -Wformat=2 noted warnings in the
> intel drivers directory.
>
> There are one set of i40e and iavf warnings I couldn't figure out how to
> fix because the driver is already using vsnprintf without an explicit
> "const char *" format string.
>
> Tested with both gcc-12 and clang-15. I found gcc-12 runs clean after
> this series but clang-15 is a little worried about the vsnprintf lines.
>
> summary of warnings:
>
> drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
>
> Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> clang-15 warnings before the patch:
>
> drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
> ^~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
> ^
> "%s",
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ixgbe_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
> ixgbe_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igc_gstrings_net_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
> igc_gstrings_net_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igb_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
> igb_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igb_gstrings_net_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
> igb_gstrings_net_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
> ^
> "%s",
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ice_gstrings_vsi_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
> ice_gstrings_vsi_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ice_gstrings_pf_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
> ice_gstrings_pf_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
> ^
> "%s",
> ---
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++++--
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 8 +++-----
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++++---
> drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ++--
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 +++--
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++--
> 6 files changed, 18 insertions(+), 16 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-next v1 2/2] intel: fix format warnings
2023-10-03 18:36 ` [PATCH iwl-next v1 2/2] intel: fix format warnings Jesse Brandeburg
2023-10-12 10:12 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
@ 2023-10-12 10:13 ` Pucha, HimasekharX Reddy
1 sibling, 0 replies; 9+ messages in thread
From: Pucha, HimasekharX Reddy @ 2023-10-12 10:13 UTC (permalink / raw)
To: Brandeburg, Jesse, intel-wired-lan
Cc: netdev, Lobakin, Aleksander, Christophe JAILLET, Brandeburg,
Jesse, Kitszel, Przemyslaw
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Jesse Brandeburg
> Sent: Wednesday, October 4, 2023 12:06 AM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Lobakin, Aleksander <aleksander.lobakin@intel.com>; Christophe JAILLET <christophe.jaillet@wanadoo.fr>; Brandeburg, Jesse <jesse.brandeburg@intel.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v1 2/2] intel: fix format warnings
>
> Get ahead of the game and fix all the -Wformat=2 noted warnings in the
> intel drivers directory.
>
> There are one set of i40e and iavf warnings I couldn't figure out how to
> fix because the driver is already using vsnprintf without an explicit
> "const char *" format string.
>
> Tested with both gcc-12 and clang-15. I found gcc-12 runs clean after
> this series but clang-15 is a little worried about the vsnprintf lines.
>
> summary of warnings:
>
> drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
>
> Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> clang-15 warnings before the patch:
>
> drivers/net/ethernet/intel/fm10k/fm10k_ethtool.c:148:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
> ^~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1416:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, ixgbe_gstrings_test[i]);
> ^
> "%s",
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ixgbe_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c:1421:6: note: treat the string as an argument to avoid this
> ixgbe_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igc/igc_ethtool.c:776:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, igc_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igc_gstrings_net_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igc/igc_ethtool.c:779:6: note: treat the string as an argument to avoid this
> igc_gstrings_net_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c:199:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igb_gstrings_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2360:6: note: treat the string as an argument to avoid this
> igb_gstrings_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> igb_gstrings_net_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/igb/igb_ethtool.c:2363:6: note: treat the string as an argument to avoid this
> igb_gstrings_net_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:208:34: warning: format string is not a string literal [-Wformat-nonliteral]
> vsnprintf(*p, ETH_GSTRING_LEN, stats[i].stat_string, args);
> ^~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2515:23: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, i40e_gstrings_priv_flags[i].flag_string);
> ^
> "%s",
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c:2519:23: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, i40e_gl_gstrings_priv_flags[i].flag_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ice_gstrings_vsi_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1064:6: note: treat the string as an argument to avoid this
> ice_gstrings_vsi_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ice_gstrings_pf_stats[i].stat_string);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1084:6: note: treat the string as an argument to avoid this
> ice_gstrings_pf_stats[i].stat_string);
> ^
> "%s",
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
> ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/intel/ice/ice_ethtool.c:1100:24: note: treat the string as an argument to avoid this
> ethtool_sprintf(&p, ice_gstrings_priv_flags[i].name);
> ^
> "%s",
> ---
> drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 6 ++++--
> drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 8 +++-----
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 7 ++++---
> drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ++--
> drivers/net/ethernet/intel/igc/igc_ethtool.c | 5 +++--
> drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++--
> 6 files changed, 18 insertions(+), 16 deletions(-)
>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-10-12 10:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 18:36 [PATCH iwl-next v1 0/2] intel: format specifier cleanups Jesse Brandeburg
2023-10-03 18:36 ` [PATCH iwl-next v1 1/2] intel: fix string truncation warnings Jesse Brandeburg
2023-10-12 10:12 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-10-03 18:36 ` [PATCH iwl-next v1 2/2] intel: fix format warnings Jesse Brandeburg
2023-10-12 10:12 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
2023-10-12 10:13 ` Pucha, HimasekharX Reddy
2023-10-04 13:45 ` [PATCH iwl-next v1 0/2] intel: format specifier cleanups Simon Horman
2023-10-06 15:16 ` [Intel-wired-lan] " Romanowski, Rafal
2023-10-09 10:50 ` Romanowski, Rafal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).