[13/25] net/bnxt: replace snprintf with strlcpy

Message ID 20230601150106.18375-14-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 p.m. UTC
  Suggested by devtools/cocci/strlcpy-with-header.cocci

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

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ef7b8859d997..d6aa84f6d3e4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2983,8 +2983,8 @@  bnxt_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
 
 	for (i = 0; i < RTE_DIM(bnxt_rx_burst_info); i++) {
 		if (pkt_burst == bnxt_rx_burst_info[i].pkt_burst) {
-			snprintf(mode->info, sizeof(mode->info), "%s",
-				 bnxt_rx_burst_info[i].info);
+			strlcpy(mode->info, bnxt_rx_burst_info[i].info,
+				sizeof(mode->info));
 			return 0;
 		}
 	}
@@ -3017,8 +3017,8 @@  bnxt_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
 
 	for (i = 0; i < RTE_DIM(bnxt_tx_burst_info); i++) {
 		if (pkt_burst == bnxt_tx_burst_info[i].pkt_burst) {
-			snprintf(mode->info, sizeof(mode->info), "%s",
-				 bnxt_tx_burst_info[i].info);
+			strlcpy(mode->info, bnxt_tx_burst_info[i].info,
+				sizeof(mode->info));
 			return 0;
 		}
 	}