[PATCH v2 19/43] crypto/caam_jr: use rte strerror

Dengdui Huang huangdengdui at huawei.com
Tue Nov 14 12:23:43 CET 2023


The function strerror() is insecure in a multi-thread environment.
This patch uses rte_strerror() to replace it.

Cc: stable at dpdk.org

Signed-off-by: Dengdui Huang <huangdengdui at huawei.com>
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
---
 drivers/crypto/caam_jr/caam_jr_uio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c
index 583ba3b523..b612407c41 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) {
 		printf("\nError opening directory '%s': %s\n",
-			SEC_UIO_DEVICE_SYS_ATTR_PATH, strerror(errno));
+			SEC_UIO_DEVICE_SYS_ATTR_PATH, rte_strerror(errno));
 		return -1;
 	}
 
-- 
2.33.0



More information about the dev mailing list