From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1721D45BAE; Wed, 23 Oct 2024 10:32:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C23F42D0B; Wed, 23 Oct 2024 10:29:41 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 7C74941148 for ; Wed, 23 Oct 2024 10:29:00 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4XYMcl45gXzQs7S; Wed, 23 Oct 2024 16:28:07 +0800 (CST) Received: from dggpeml500011.china.huawei.com (unknown [7.185.36.84]) by mail.maildlp.com (Postfix) with ESMTPS id 70835140360; Wed, 23 Oct 2024 16:28:59 +0800 (CST) Received: from localhost.huawei.com (10.50.165.33) by dggpeml500011.china.huawei.com (7.185.36.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 23 Oct 2024 16:28:59 +0800 From: Dengdui Huang To: CC: , , , , , , , , Subject: [PATCH v4 35/42] net/sfc: use rte strerror Date: Wed, 23 Oct 2024 16:28:45 +0800 Message-ID: <20241023082852.2780488-36-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20241023082852.2780488-1-huangdengdui@huawei.com> References: <20231114082539.1858594-44-huangdengdui@huawei.com> <20241023082852.2780488-1-huangdengdui@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500011.china.huawei.com (7.185.36.84) X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Chengwen Feng Acked-by: Morten Brørup --- drivers/net/sfc/sfc_flow.c | 2 +- drivers/net/sfc/sfc_flow_tunnel.c | 2 +- drivers/net/sfc/sfc_mae.c | 58 +++++++++++++++---------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 1006243539..db3a2fbc8f 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1397,7 +1397,7 @@ sfc_flow_parse_pattern(struct sfc_adapter *sa, rc = item->parse(pattern, parse_ctx, error); if (rc != 0) { sfc_err(sa, "failed to parse item %s: %s", - item->name, strerror(-rc)); + item->name, rte_strerror(-rc)); return rc; } diff --git a/drivers/net/sfc/sfc_flow_tunnel.c b/drivers/net/sfc/sfc_flow_tunnel.c index 889fee569a..898d00dd6d 100644 --- a/drivers/net/sfc/sfc_flow_tunnel.c +++ b/drivers/net/sfc/sfc_flow_tunnel.c @@ -120,7 +120,7 @@ sfc_ft_tunnel_rule_detect(struct sfc_adapter *sa, if (rc != 0) { /* The loop above might have spotted wrong actions. */ sfc_err(sa, "FT: TUNNEL: invalid actions: %s", - strerror(rc)); + rte_strerror(rc)); goto fail; } diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index b0e8b02b41..2813189f67 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -428,7 +428,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, &fw_rsrc->rule_id); if (rc != 0) { sfc_err(sa, "failed to enable outer_rule=%p: %s", - rule, strerror(rc)); + rule, rte_strerror(rc)); return rc; } } @@ -445,7 +445,7 @@ sfc_mae_outer_rule_enable(struct sfc_adapter *sa, fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "can't match on outer rule ID: %s", strerror(rc)); + sfc_err(sa, "can't match on outer rule ID: %s", rte_strerror(rc)); return rc; } @@ -484,7 +484,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, &invalid_rule_id); if (rc != 0) { sfc_err(sa, "cannot restore match on invalid outer rule ID: %s", - strerror(rc)); + rte_strerror(rc)); return; } @@ -503,7 +503,7 @@ sfc_mae_outer_rule_disable(struct sfc_adapter *sa, rule, fw_rsrc->rule_id.id); } else { sfc_err(sa, "failed to disable outer_rule=%p with OR_ID=0x%08x: %s", - rule, fw_rsrc->rule_id.id, strerror(rc)); + rule, fw_rsrc->rule_id.id, rte_strerror(rc)); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -616,7 +616,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, &fw_rsrc->mac_id); if (rc != 0) { sfc_err(sa, "failed to enable mac_addr=%p: %s", - mac_addr, strerror(rc)); + mac_addr, rte_strerror(rc)); return rc; } } @@ -642,7 +642,7 @@ sfc_mae_mac_addr_enable(struct sfc_adapter *sa, } sfc_err(sa, "cannot fill in MAC address entry ID: %s", - strerror(rc)); + rte_strerror(rc)); return rc; } @@ -685,7 +685,7 @@ sfc_mae_mac_addr_disable(struct sfc_adapter *sa, mac_addr, fw_rsrc->mac_id.id); } else { sfc_err(sa, "failed to disable mac_addr=%p with MAC_ID=0x%08x: %s", - mac_addr, fw_rsrc->mac_id.id, strerror(rc)); + mac_addr, fw_rsrc->mac_id.id, rte_strerror(rc)); } fw_rsrc->mac_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -818,7 +818,7 @@ sfc_mae_encap_header_update(struct sfc_adapter *sa, bounce_eh->size); if (ret != 0) { sfc_err(sa, "failed to update encap_header=%p: %s", - encap_header, strerror(ret)); + encap_header, rte_strerror(ret)); rte_free(buf); return ret; } @@ -859,7 +859,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, &fw_rsrc->eh_id); if (rc != 0) { sfc_err(sa, "failed to enable encap_header=%p: %s", - encap_header, strerror(rc)); + encap_header, rte_strerror(rc)); return rc; } } @@ -873,7 +873,7 @@ sfc_mae_encap_header_enable(struct sfc_adapter *sa, fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID; } - sfc_err(sa, "can't fill in encap. header ID: %s", strerror(rc)); + sfc_err(sa, "can't fill in encap. header ID: %s", rte_strerror(rc)); return rc; } @@ -916,7 +916,7 @@ sfc_mae_encap_header_disable(struct sfc_adapter *sa, encap_header, fw_rsrc->eh_id.id); } else { sfc_err(sa, "failed to disable encap_header=%p with EH_ID=0x%08x: %s", - encap_header, fw_rsrc->eh_id.id, strerror(rc)); + encap_header, fw_rsrc->eh_id.id, rte_strerror(rc)); } fw_rsrc->eh_id.id = EFX_MAE_RSRC_ID_INVALID; } @@ -1023,7 +1023,7 @@ sfc_mae_counter_enable(struct sfc_adapter *sa, struct sfc_mae_counter *counter, } sfc_err(sa, "cannot fill in counter ID: %s", - strerror(rc)); + rte_strerror(rc)); return rc; } } @@ -1067,7 +1067,7 @@ sfc_mae_counter_disable(struct sfc_adapter *sa, struct sfc_mae_counter *counter) counter, counter->type, counter_id); } else { sfc_err(sa, "failed to disable counter=%p with COUNTER_ID=0x%x-#%u: %s", - counter, counter->type, counter_id, strerror(rc)); + counter, counter->type, counter_id, rte_strerror(rc)); } fw_rsrc->counter_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1241,7 +1241,7 @@ sfc_mae_action_set_enable(struct sfc_adapter *sa, &fw_rsrc->aset_id); if (rc != 0) { sfc_err(sa, "failed to enable action_set=%p: %s", - action_set, strerror(rc)); + action_set, rte_strerror(rc)); sfc_mae_encap_header_disable(sa, encap_header); sfc_mae_mac_addr_disable(sa, src_mac_addr); @@ -1289,7 +1289,7 @@ sfc_mae_action_set_disable(struct sfc_adapter *sa, action_set, fw_rsrc->aset_id.id); } else { sfc_err(sa, "failed to disable action_set=%p with AS_ID=0x%08x: %s", - action_set, fw_rsrc->aset_id.id, strerror(rc)); + action_set, fw_rsrc->aset_id.id, rte_strerror(rc)); } fw_rsrc->aset_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1445,7 +1445,7 @@ sfc_mae_action_set_list_enable(struct sfc_adapter *sa, &fw_rsrc->aset_list_id); if (rc != 0) { sfc_err(sa, "failed to enable action_set_list=%p: %s", - action_set_list, strerror(rc)); + action_set_list, rte_strerror(rc)); goto fail_action_set_list_alloc; } @@ -1498,7 +1498,7 @@ sfc_mae_action_set_list_disable(struct sfc_adapter *sa, } else { sfc_err(sa, "failed to disable action_set_list=%p with ASL_ID=0x%08x: %s", action_set_list, fw_rsrc->aset_list_id.id, - strerror(rc)); + rte_strerror(rc)); } fw_rsrc->aset_list_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -1708,7 +1708,7 @@ sfc_mae_action_rule_enable(struct sfc_adapter *sa, as_idp, &fw_rsrc->rule_id); if (rc != 0) { sfc_err(sa, "failed to enable action_rule=%p: %s", - rule, strerror(rc)); + rule, rte_strerror(rc)); goto fail_action_rule_insert; } @@ -1759,7 +1759,7 @@ sfc_mae_action_rule_disable(struct sfc_adapter *sa, rule, fw_rsrc->rule_id.id); } else { sfc_err(sa, "failed to disable action_rule=%p with AR_ID=0x%08x: %s", - rule, fw_rsrc->rule_id.id, strerror(rc)); + rule, fw_rsrc->rule_id.id, rte_strerror(rc)); } fw_rsrc->rule_id.id = EFX_MAE_RSRC_ID_INVALID; @@ -4396,7 +4396,7 @@ sfc_mae_rule_parse_action_mark(struct sfc_adapter *sa, rc = efx_mae_action_set_populate_mark(spec, conf->id); if (rc != 0) - sfc_err(sa, "failed to request action MARK: %s", strerror(rc)); + sfc_err(sa, "failed to request action MARK: %s", rte_strerror(rc)); return rc; } @@ -4570,14 +4570,14 @@ sfc_mae_rule_parse_action_pf_vf(struct sfc_adapter *sa, if (rc != 0) { sfc_err(sa, "failed to convert PF %u VF %d to m-port: %s", encp->enc_pf, (vf != EFX_PCI_VF_INVALID) ? (int)vf : -1, - strerror(rc)); + rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4606,14 +4606,14 @@ sfc_mae_rule_parse_action_port_id(struct sfc_adapter *sa, port_id, type_mask, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - port_id, strerror(rc)); + port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4632,14 +4632,14 @@ sfc_mae_rule_parse_action_port_representor(struct sfc_adapter *sa, conf->port_id, type_mask, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4658,14 +4658,14 @@ sfc_mae_rule_parse_action_represented_port(struct sfc_adapter *sa, conf->port_id, &mport); if (rc != 0) { sfc_err(sa, "failed to get m-port for the given ethdev (port_id=%u): %s", - conf->port_id, strerror(rc)); + conf->port_id, rte_strerror(rc)); return rc; } rc = efx_mae_action_set_populate_deliver(spec, &mport); if (rc != 0) { sfc_err(sa, "failed to request action DELIVER with m-port selector 0x%08x: %s", - mport.sel, strerror(rc)); + mport.sel, rte_strerror(rc)); } return rc; @@ -4758,7 +4758,7 @@ sfc_mae_rule_parse_action_rc(struct sfc_adapter *sa, if (action_name != NULL) { sfc_err(sa, "action %s was rejected: %s", - action_name, strerror(rc)); + action_name, rte_strerror(rc)); } } rc = rte_flow_error_set(error, rc, RTE_FLOW_ERROR_TYPE_ACTION, -- 2.33.0