From 06553566a841cc5ff8cd4dd11c00251b834c7fba Mon Sep 17 00:00:00 2001 From: David Laight Date: Sat, 6 Jun 2026 21:26:00 +0100 Subject: [PATCH] kernfs: Replace strcpy(s, "../") with memcpy(s, "../", 4) The code has already checked there is enough room. Use memcpy() to avoid compiler warnings from possibly unbounded strcpy(). Signed-off-by: David Laight Link: https://patch.msgid.link/20260606202633.5018-6-david.laight.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- fs/kernfs/symlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/kernfs/symlink.c b/fs/kernfs/symlink.c index 0bd8a2143723..90e2b3221b83 100644 --- a/fs/kernfs/symlink.c +++ b/fs/kernfs/symlink.c @@ -73,7 +73,7 @@ static int kernfs_get_target_path(struct kernfs_node *parent, if ((s - path) + 3 >= PATH_MAX) return -ENAMETOOLONG; - strcpy(s, "../"); + memcpy(s, "../", 4); s += 3; base = kernfs_parent(base); }