The function strerror() is insecure in a multi-thread environment.
rte_strerror() has been provided in DPDK to replace it.

Signed-off-by: Dengdui Huang <huangdeng...@huawei.com>
Acked-by: Chengwen Feng <fengcheng...@huawei.com>
---
 devtools/checkpatches.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 066449d147..7fbd0df3b3 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -159,6 +159,14 @@ check_forbidden_additions() { # <patch>
                -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
                "$1" || res=1
 
+       # refrain from using strerror() for drivers and libs
+       awk -v FOLDERS="lib drivers" \
+               -v EXPRESSIONS="\\\sstrerror\\\(" \
+               -v RET_ON_FAIL=1 \
+               -v MESSAGE='Using strerror, prefer rte_strerror' \
+               -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+               "$1" || res=1
+
        # refrain from using RTE_LOG_REGISTER for drivers and libs
        awk -v FOLDERS='lib drivers' \
                -v EXPRESSIONS='\\<RTE_LOG_REGISTER\\>' \
-- 
2.33.0

Reply via email to