[PATCH] Use strscpy() instead of the deprecated strlcpy()

From: Daniel Yang
Date: Tue Nov 05 2024 - 02:06:30 EST


The latest kernel doc:
https://www.kernel.org/doc/html/latest/process/deprecated.html
recommends replacing strlcpy with strscpy. Since the return value of
strlcpy is not used, replacing with strscpy should be safe.

Signed-off-by: Daniel Yang <danielyangkang@xxxxxxxxx>
---
tools/perf/util/symbol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 3bbf173ad..660ed5626 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1893,7 +1893,7 @@ int dso__load(struct dso *dso, struct map *map)
char *new_name = dso__filename_with_chroot(dso, name);
if (new_name) {
is_reg = is_regular_file(new_name);
- strlcpy(name, new_name, PATH_MAX);
+ strscpy(name, new_name, PATH_MAX);
free(new_name);
}
}
--
2.39.2