[PATCH] perf tools: Replace strlcpy with strscpy

ny posted 1 patch 1 week, 2 days ago
tools/perf/util/machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] perf tools: Replace strlcpy with strscpy
Posted by ny 1 week, 2 days ago
Replace the deprecated strlcpy function with the preferred strscpy
function in tools/perf/util/machine.c.

strlcpy is deprecated and should be replaced with strscpy according
to kernel best practices. The strscpy function is safer and is the
recommended replacement.

Signed-off-by: ny <nygameemail@163.com>
---
 tools/perf/util/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 841b711d9..8786764e2 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1052,7 +1052,7 @@ int machine__create_extra_kernel_map(struct machine *machine,
 
 	kmap = map__kmap(map);
 
-	strlcpy(kmap->name, xm->name, KMAP_NAME_LEN);
+	strscpy(kmap->name, xm->name, KMAP_NAME_LEN);
 
 	err = maps__insert(machine__kernel_maps(machine), map);
 
-- 
2.43.0