veth: use ethtool_sprintf instead of snprintf
Subsystems (2)
PATCH v2 1/1 veth: use ethtool_sprintf instead of snprintf
From: Tonghao Zhang <[email protected]>
use ethtools api ethtool_sprintf to instead of snprintf.
Cc Jakub Kicinski <[email protected]>
Cc "David S. Miller" <[email protected]>
Signed-off-by Tonghao Zhang <[email protected]>
--- drivers/net/veth.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
drivers/net/veth.c +10 -17
@@ -134,29 +134,22 @@ static void veth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *infstatic void veth_get_strings (struct net_device *dev,u32 stringset,u8 *buf) { -char *p = (char *)buf; +u8 *p = buf;int i, j;switch (stringset) {case ETH_SS_STATS :memcpy (p, ðtool_stats_keys,sizeof (ethtool_stats_keys)); p +=sizeof (ethtool_stats_keys); -for (i =0 ; i < dev->real_num_rx_queues; i++) { -for (j =0 ; j <VETH_RQ_STATS_LEN ; j++) { -snprintf (p,ETH_GSTRING_LEN , -"rx_queue_%u_%.18s" , - i, veth_rq_stats_desc[j].desc); - p +=ETH_GSTRING_LEN ; - } - } -for (i =0 ; i < dev->real_num_tx_queues; i++) { -for (j =0 ; j <VETH_TQ_STATS_LEN ; j++) { -snprintf (p,ETH_GSTRING_LEN , -"tx_queue_%u_%.18s" , - i, veth_tq_stats_desc[j].desc); - p +=ETH_GSTRING_LEN ; - } - } +for (i =0 ; i < dev->real_num_rx_queues; i++) +for (j =0 ; j <VETH_RQ_STATS_LEN ; j++) +ethtool_sprintf (&p,"rx_queue_%u_%.18s" , + i, veth_rq_stats_desc[j].desc); + +for (i =0 ; i < dev->real_num_tx_queues; i++) +for (j =0 ; j <VETH_TQ_STATS_LEN ; j++) +ethtool_sprintf (&p,"tx_queue_%u_%.18s" , + i, veth_tq_stats_desc[j].desc);break ; } }
Signature · 1 line
2.27.0
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Thu, 25 Nov 2021 10:54:44 +0800 you wrote:
From: Tonghao Zhang <[email protected]>
use ethtools api
ethtool_sprintfto instead of snprintf.Cc Jakub Kicinski <[email protected]>Cc "David S. Miller" <[email protected]>Signed-off-by Tonghao Zhang <[email protected]>[...]
Here is the summary with links:
- [net-next,v2] veth: use ethtool_sprintf instead of snprintf
https://git.kernel.org/netdev/net-next/c/a0341b73d843
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html