On Thu, Jun 04, 2026 at 03:17:53PM +0200, Thorsten Blum wrote: > In preparation to remove strlcat() from the kernel [1], replace two > strlcat() calls with one snprintf() call in setup_arch(). > > Also drop the explicit size argument of strscpy() to further simplify > the code since strscpy() can determine the size automatically when the > destination buffer has a fixed length.
> [1] https://github.com/KSPP/linux/issues/370 Make it Link tag? ... > strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); This also has third argument fixed. Don't you want to change that? > #else > if (builtin_cmdline[0]) { > + size_t len = strnlen(builtin_cmdline, COMMAND_LINE_SIZE); > + > /* append boot loader cmdline to builtin */ > - strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE); > - strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE); > + snprintf(builtin_cmdline + len, COMMAND_LINE_SIZE - len, " %s", > + boot_command_line); Hmm... Wouldn't GCC complain on this? (Build with `make W=1`.) > strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); And this has also third argument. > } > #endif > builtin_cmdline_added = true; > #endif > > - strscpy(command_line, boot_command_line, COMMAND_LINE_SIZE); > + strscpy(command_line, boot_command_line); -- With Best Regards, Andy Shevchenko

