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 24FA043325; Tue, 14 Nov 2023 09:29:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7B7E427DD; Tue, 14 Nov 2023 09:26:21 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 892CA4067D for ; Tue, 14 Nov 2023 09:25:46 +0100 (CET) Received: from dggpeml500011.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4STzmz5Swxz1P8Kg; Tue, 14 Nov 2023 16:22:27 +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_128_GCM_SHA256) id 15.1.2507.31; Tue, 14 Nov 2023 16:25:45 +0800 From: Dengdui Huang To: CC: , , , , Subject: [PATCH 36/43] net/sfc: use rte strerror Date: Tue, 14 Nov 2023 16:25:32 +0800 Message-ID: <20231114082539.1858594-37-huangdengdui@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231114082539.1858594-1-huangdengdui@huawei.com> References: <20231114082539.1858594-1-huangdengdui@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.50.165.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500011.china.huawei.com (7.185.36.84) X-CFilter-Loop: Reflected 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 --- 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 1b50aefe5c..304628026d 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -1403,7 +1403,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 e5ec0ae49d..accde9bcb0 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -429,7 +429,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; } } @@ -446,7 +446,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; } @@ -485,7 +485,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; } @@ -504,7 +504,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; } @@ -618,7 +618,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; } } @@ -644,7 +644,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; } @@ -687,7 +687,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; } @@ -820,7 +820,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; } @@ -861,7 +861,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; } } @@ -875,7 +875,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; } @@ -918,7 +918,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; @@ -1242,7 +1242,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); @@ -1290,7 +1290,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; @@ -1446,7 +1446,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; } @@ -1499,7 +1499,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; @@ -1710,7 +1710,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; } @@ -1761,7 +1761,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; @@ -4398,7 +4398,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