The function strerror() is insecure in a multi-thread environment. This patch uses rte_strerror() to replace it.
Cc: sta...@dpdk.org Signed-off-by: Dengdui Huang <huangdeng...@huawei.com> Acked-by: Chengwen Feng <fengcheng...@huawei.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(-) 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 99e496556a..1d20d421bc 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\n", - __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 71a91675f7..b7e966f393 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 c40d18d128..fdf152a51a 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\n", - __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\n", __func__, bond_dev->data->port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } @@ -2292,7 +2292,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\n", __func__, member.port_id, - strerror(-ret)); + rte_strerror(-ret)); return ret; } -- 2.33.0