[v4,18/42] crypto/caam_jr: use rte strerror

Message ID 20241023082852.2780488-19-huangdengdui@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series replace strerror |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

huangdengdui Oct. 23, 2024, 8:28 a.m. UTC
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 <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 8956f7750d..cdd027aeae 100644
--- a/drivers/crypto/caam_jr/caam_jr_uio.c
+++ b/drivers/crypto/caam_jr/caam_jr_uio.c
@@ -17,6 +17,7 @@ 
 #include <rte_malloc.h>
 #include <rte_crypto.h>
 #include <rte_security.h>
+#include <rte_errno.h>
 
 #include <caam_jr_config.h>
 #include <caam_jr_hw_specific.h>
@@ -355,7 +356,7 @@  free_job_ring(int uio_fd)
 	if (munmap(job_ring->register_base_addr, job_ring->map_size)) {
 		CAAM_JR_INFO("cannot munmap(%p, 0x%lx): %s",
 			job_ring->register_base_addr,
-			(unsigned long)job_ring->map_size, strerror(errno));
+			(unsigned long)job_ring->map_size, rte_strerror(errno));
 	} else
 		CAAM_JR_DEBUG("JR UIO memory is unmapped");
 
@@ -419,7 +420,7 @@  sec_configure(void)
 	d = opendir(SEC_UIO_DEVICE_SYS_ATTR_PATH);
 	if (d == NULL) {
 		CAAM_JR_ERR("Error opening directory '%s': %s",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}