[dpdk-dev] [PATCH 1/4] net/hns3: fix passing negative parameter to strerror

Wei Hu (Xavier) xavier.huwei at huawei.com
Tue Jun 9 10:44:14 CEST 2020


There is a coverity defect related "Argument cannot be negative".

This patch fixes it by passing '-ret' to the function strerror() when ret
is negative.

Coverity issue: 349933
Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable at dpdk.org

Signed-off-by: Wei Hu (Xavier) <xavier.huwei at huawei.com>
---
 drivers/net/hns3/hns3_fdir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c
index 4c5928f..7bc5bf8 100644
--- a/drivers/net/hns3/hns3_fdir.c
+++ b/drivers/net/hns3/hns3_fdir.c
@@ -893,7 +893,7 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw,
 	if (ret < 0) {
 		rte_spinlock_unlock(&fdir_info->flows_lock);
 		hns3_err(hw, "Hash table full? err:%d(%s)!", ret,
-			 strerror(ret));
+			 strerror(-ret));
 		return ret;
 	}
 
-- 
2.7.4



More information about the dev mailing list