[23/25] net/ngbe: replace snprintf with strlcpy

Message ID 20230601150106.18375-24-stephen@networkplumber.org (mailing list archive)
State Rejected
Delegated to: Thomas Monjalon
Headers
Series replace snprintf with strlcpy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger June 1, 2023, 3:01 p.m. UTC
  Suggested by devtools/cocci/strlcpy-with-header.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ngbe/ngbe_rxtx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index 0c678e155726..dc6043f3620a 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -1875,8 +1875,8 @@  ngbe_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
 
 	for (i = 0; i < RTE_DIM(ngbe_tx_burst_infos); ++i) {
 		if (pkt_burst == ngbe_tx_burst_infos[i].pkt_burst) {
-			snprintf(mode->info, sizeof(mode->info), "%s",
-				 ngbe_tx_burst_infos[i].info);
+			strlcpy(mode->info, ngbe_tx_burst_infos[i].info,
+				sizeof(mode->info));
 			ret = 0;
 			break;
 		}
@@ -2785,8 +2785,8 @@  ngbe_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
 
 	for (i = 0; i < RTE_DIM(ngbe_rx_burst_infos); ++i) {
 		if (pkt_burst == ngbe_rx_burst_infos[i].pkt_burst) {
-			snprintf(mode->info, sizeof(mode->info), "%s",
-				 ngbe_rx_burst_infos[i].info);
+			strlcpy(mode->info, ngbe_rx_burst_infos[i].info,
+				sizeof(mode->info));
 			ret = 0;
 			break;
 		}