Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] x86/setup: stack frame size exceeded in setup_arch()
--

commit 77de53f82acddaba0d28234aa8f72d7d99b20943
Author: Bill Wendling <[email protected]>

x86/setup: Use snprintf() to concatenate builtin and boot command lines

This commit replaces multiple strlcat() calls with a single snprintf()
call in setup_arch() to concatenate the builtin and boot command lines.
It uses a temporary buffer to avoid undefined behavior from overlapping
source and destination buffers, preparing for the removal of the
deprecated strlcat() API.

Link: https://github.com/KSPP/linux/issues/370 [1]

> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -916,9 +916,11 @@ void __init setup_arch(char **cmdline_p)
>  #else
>       if (builtin_cmdline[0]) {
>               /* append boot loader cmdline to builtin */
> -             strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
> -             strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> -             strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
> +             char tmp[COMMAND_LINE_SIZE];

[Severity: Low]
Will this unconditionally trigger a -Wframe-larger-than warning during build?

COMMAND_LINE_SIZE is 2048 on x86_64, which matches the default warning
threshold for stack frames (CONFIG_FRAME_WARN). 

Combined with the function overhead and other local variables, allocating
this array directly on the stack will reliably exceed the limit and break
builds that have CONFIG_WERROR enabled.

> +
> +             snprintf(tmp, COMMAND_LINE_SIZE, "%s %s", builtin_cmdline, 
> boot_command_line);
> +             strscpy(builtin_cmdline, tmp, COMMAND_LINE_SIZE);
> +             strscpy(boot_command_line, tmp, COMMAND_LINE_SIZE);
>       }
>  #endif
>       builtin_cmdline_added = true;

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=19

Reply via email to