[PATCH 07/25] drivers/gpu: replace snprintf with strlcpy
Stephen Hemminger
stephen at networkplumber.org
Thu Jun 1 17:00:48 CEST 2023
Suggested by devtools/cocci/strlcpy-with-header.cocci
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/gpu/cuda/cuda.c | 2 +-
drivers/gpu/cuda/gdrcopy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index a552aabeb82d..01875816d592 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -291,7 +291,7 @@ cuda_loader(void)
char cuda_path[1024];
if (getenv("CUDA_PATH_L") == NULL)
- snprintf(cuda_path, 1024, "%s", "libcuda.so");
+ strlcpy(cuda_path, "libcuda.so", 1024);
else
snprintf(cuda_path, 1024, "%s/%s", getenv("CUDA_PATH_L"), "libcuda.so");
diff --git a/drivers/gpu/cuda/gdrcopy.c b/drivers/gpu/cuda/gdrcopy.c
index 322a5dbeb207..ad7809a99b00 100644
--- a/drivers/gpu/cuda/gdrcopy.c
+++ b/drivers/gpu/cuda/gdrcopy.c
@@ -20,7 +20,7 @@ gdrcopy_loader(void)
char gdrcopy_path[1024];
if (getenv("GDRCOPY_PATH_L") == NULL)
- snprintf(gdrcopy_path, 1024, "%s", "libgdrapi.so");
+ strlcpy(gdrcopy_path, "libgdrapi.so", 1024);
else
snprintf(gdrcopy_path, 1024, "%s/%s", getenv("GDRCOPY_PATH_L"), "libgdrapi.so");
--
2.39.2
More information about the dev
mailing list