* + gcov-use-strscpy-instead-of-strcpy-in-init_node.patch added to mm-nonmm-unstable branch
@ 2026-08-31 23:49 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-31 23:49 UTC (permalink / raw)
To: mm-commits, oberpar, brads, hrushirajg23, akpm
The patch titled
Subject: gcov: use strscpy() instead of strcpy() in init_node()
has been added to the -mm mm-nonmm-unstable branch. Its filename is
gcov-use-strscpy-instead-of-strcpy-in-init_node.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/gcov-use-strscpy-instead-of-strcpy-in-init_node.patch
This patch will later appear in the mm-nonmm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Hrushiraj Gandhi <hrushirajg23@gmail.com>
Subject: gcov: use strscpy() instead of strcpy() in init_node()
Date: Mon, 31 Aug 2026 20:19:53 +0530
node->name is a flexible array member sized to exactly strlen(name) + 1
bytes at allocation time in new_node(), so this copy can never actually
overflow. Still, prefer the bounded strscpy() over strcpy() on general
principle; pass the same strlen(name) + 1 bound the allocation used, since
sizeof() cannot be applied to a flexible array member.
No functional change.
Link: https://lore.kernel.org/20260831144953.324441-1-hrushirajg23@gmail.com
Signed-off-by: Hrushiraj Gandhi <hrushirajg23@gmail.com>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/gcov/fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel/gcov/fs.c~gcov-use-strscpy-instead-of-strcpy-in-init_node
+++ a/kernel/gcov/fs.c
@@ -529,7 +529,7 @@ static void init_node(struct gcov_node *
}
node->parent = parent;
if (name)
- strcpy(node->name, name);
+ strscpy(node->name, name, strlen(name) + 1);
}
/*
_
Patches currently in -mm which might be from hrushirajg23@gmail.com are
gcov-use-strscpy-instead-of-strcpy-in-init_node.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-31 23:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 23:49 + gcov-use-strscpy-instead-of-strcpy-in-init_node.patch added to mm-nonmm-unstable branch Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox