[v4,01/42] devtools: forbid use of strerror
Checks
Commit Message
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 <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
devtools/checkpatches.sh | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -209,6 +209,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\\>' \