Re: [PATCH] init: Use scnprintf() to simplify setup_command_line()
From: Thorsten Blum
Date: Thu Nov 26 2026 - 16:40:42 EST
Hi Masami,
On Wed, Nov 18, 2026 at 09:10:32AM +0900, Masami Hiramatsu (Google) wrote:
> On Wed, 18 Nov 2026 00:48:04 +0100, Thorsten Blum <blum@xxxxxxxxxx> wrote:
> > strcpy() has been deprecated [1] because it performs no bounds checking
> > on the destination buffer, which can lead to buffer overflows.
> >
> > Use scnprintf() to format the saved and static command lines while
> > taking their buffer sizes into account. Use scnprintf()'s return value
> > to keep track of saved_command_line_len and avoid extra strlen() calls.
> >
> > No functional change.
> >
> > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy [1]
> > Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
>
> Looks good to me. Let me pick this to bootconfig/core.
Have you applied this yet? I couldn't find it in the bootconfig/core
branch, which hasn't been updated in 5 years:
https://git.kernel.org/pub/scm/linux/kernel/git/mhiramat/linux.git/log/?h=bootconfig/core
Is there a different tree I should be looking at?
Thanks,
Thorsten