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 <david.laight.linux@gmail.com>
Link: https://patch.msgid.link/20260606202633.5018-6-david.laight.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
David Laight 2026-06-06 21:26:00 +01:00 committed by Danilo Krummrich
parent d996995a0f
commit 06553566a8

View File

@ -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);
}