Skip to contentSkip to conversation

initramfs: Replace strcpy() with strscpy() in find_link()

PATCH Applied Thorsten Blum 3 participants 3 messages Sep 12, 2025 – Sep 15, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 initramfs: Replace strcpy() with strscpy() in find_link()

strcpy() is deprecated; use strscpy() instead.

---
 init/initramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
init/initramfs.c +1 -1
index 097673b97784..6745e3fbc7ab 100644
@@ -108,7 +108,7 @@ static char __init *find_link(int major, int minor, int ino,
 	q->minor = minor;
 	q->ino = ino;
 	q->mode = mode;
-	strcpy(q->name, name);
+	strscpy(q->name, name);
 	q->next = NULL;
 	*p = q;
 	hardlink_seen = true;
Signature · 1 line
2.51.0
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 4 lines · Thorsten Blum

strcpy() is deprecated; use strscpy() instead.

Quoted 21 lines
---
 init/initramfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
init/initramfs.c +1 -1
index 097673b97784..6745e3fbc7ab 100644
@@ -108,7 +108,7 @@ static char __init *find_link(int major, int minor, int ino,
 	q->minor = minor;
 	q->ino = ino;
 	q->mode = mode;
-	strcpy(q->name, name);
+	strscpy(q->name, name);
 	q->next = NULL;
 	*p = q;
 	hardlink_seen = true;
Signature · 1 line
2.51.0

Thanks
Justin

maintainer Applied
#2 lore raw
In reply to Thorsten Blum
Quoted 3 lines · Thorsten Blum

strcpy() is deprecated; use strscpy() instead.

Applied to the vfs-6.18.misc branch of the vfs/vfs.git tree. Patches in the vfs-6.18.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.18.misc

[1/1] initramfs: Replace strcpy() with strscpy() in find_link()

      https://git.kernel.org/vfs/vfs/c/afd77d2050c3