Re: [PATCH] x86: replace char builtin_cmdline[COMMAND_LINE_SIZE] with struct seq_buf

From: Michal Gorlas

Date: Sun Mar 22 2026 - 18:29:35 EST


Okay, so the Sashiko bot found out two regressions [1] that I missed out.
First one about builtin_cmdline.buffer not being initialized for any
early callers of __cmdline_find_option() and __cmdline_find_option_bool()
could be fixed by letting builtin_cmdline be initialized like this:
+ char cmdline_buf[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
+ struct seq_buf builtin_cmdline = {
+ .buffer = cmdline_buf,
+ .size = COMMAND_LINE_SIZE,
+ .len = sizeof(CONFIG_CMDLINE) - 1,
+ };

But as for the second issue (handling case when (builtin_cmdline
+ boot_command_line) > COMMAND_LINE_SIZE), I am not sure whether even
using seq_buf makes any sense at all. snprintf() (also mentioned as
potential replacement for strlcat in [2]) would make more sense (I think)
and the whole patch would suffice to this:
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);
+ snprintf(builtin_cmdline, COMMAND_LINE_SIZE, "%s %s",
+ CONFIG_CMDLINE, boot_command_line);
strscpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
}

Let me know whether this makes sense.

Best,
Michal

[1] - https://sashiko.dev/#/patchset/20260322-x86-remove-strlcat-v1-1-4ff893595133%409elements.com
[2] - https://github.com/KSPP/linux/issues/370