[v4,23/42] net/bonding: use rte strerror

Message ID 20241023082852.2780488-24-huangdengdui@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series replace strerror |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

huangdengdui Oct. 23, 2024, 8:28 a.m. UTC
The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable@dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/net/bonding/bonding_testpmd.c   | 4 ++--
 drivers/net/bonding/rte_eth_bond_api.c  | 2 +-
 drivers/net/bonding/rte_eth_bond_flow.c | 4 ++--
 drivers/net/bonding/rte_eth_bond_pmd.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)
  

Patch

diff --git a/drivers/net/bonding/bonding_testpmd.c b/drivers/net/bonding/bonding_testpmd.c
index 8fcd6cadd0..111f9de0e7 100644
--- a/drivers/net/bonding/bonding_testpmd.c
+++ b/drivers/net/bonding/bonding_testpmd.c
@@ -551,7 +551,7 @@  static void cmd_set_bond_mac_addr_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mac_addr_set =
@@ -604,7 +604,7 @@  static void cmd_set_bond_mon_period_parsed(void *parsed_result,
 	/* check the return value and print it if is < 0 */
 	if (ret < 0)
 		fprintf(stderr, "set_bond_mac_addr error: (%s)\n",
-			strerror(-ret));
+			rte_strerror(-ret));
 }
 
 static cmdline_parse_token_string_t cmd_set_bond_mon_period_set =
diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c
index ffc1322047..dbb642dc4c 100644
--- a/drivers/net/bonding/rte_eth_bond_api.c
+++ b/drivers/net/bonding/rte_eth_bond_api.c
@@ -483,7 +483,7 @@  __eth_bond_member_add_lock_free(uint16_t bonding_port_id, uint16_t member_port_i
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s",
-			__func__, member_port_id, strerror(-ret));
+			__func__, member_port_id, rte_strerror(-ret));
 
 		return ret;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c
index 5d0be5caf5..a38cc84f56 100644
--- a/drivers/net/bonding/rte_eth_bond_flow.c
+++ b/drivers/net/bonding/rte_eth_bond_flow.c
@@ -31,7 +31,7 @@  bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Unable to process flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		return NULL;
 	}
 	flow = rte_zmalloc_socket(NULL, offsetof(struct rte_flow, rule) + ret,
@@ -45,7 +45,7 @@  bond_flow_alloc(int numa_node, const struct rte_flow_attr *attr,
 	if (ret < 0) {
 		RTE_BOND_LOG(ERR, "Failed to copy flow rule (%s): %s",
 			     error.message ? error.message : "unspecified",
-			     strerror(rte_errno));
+			     rte_strerror(rte_errno));
 		rte_free(flow);
 		return NULL;
 	}
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index cda1c37124..95049eead6 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -192,7 +192,7 @@  bond_ethdev_8023ad_flow_verify(struct rte_eth_dev *bond_dev,
 	if (ret != 0) {
 		RTE_BOND_LOG(ERR,
 			"%s: Error during getting device (port %u) info: %s",
-			__func__, member_port, strerror(-ret));
+			__func__, member_port, rte_strerror(-ret));
 
 		return ret;
 	}
@@ -223,7 +223,7 @@  bond_8023ad_slow_pkt_hw_filter_supported(uint16_t port_id) {
 			RTE_BOND_LOG(ERR,
 				"%s: Error during getting device (port %u) info: %s",
 				__func__, bond_dev->data->port_id,
-				strerror(-ret));
+				rte_strerror(-ret));
 
 			return ret;
 		}
@@ -2290,7 +2290,7 @@  bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 					"%s: Error during getting device (port %u) info: %s",
 					__func__,
 					member.port_id,
-					strerror(-ret));
+					rte_strerror(-ret));
 
 				return ret;
 			}