From: Michal Gorlas <michal.gorlas@9elements.com>
To: Kees Cook <kees@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org,
Michal Gorlas <michal.gorlas@9elements.com>
Subject: Re: [PATCH] x86: replace char builtin_cmdline[COMMAND_LINE_SIZE] with struct seq_buf
Date: Sun, 22 Mar 2026 23:29:21 +0100 [thread overview]
Message-ID: <acBtQWhiFV2fANAZ@cyber-t14sg4> (raw)
In-Reply-To: <20260322-x86-remove-strlcat-v1-1-4ff893595133@9elements.com>
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
prev parent reply other threads:[~2026-03-22 22:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 17:43 Michal Gorlas
2026-03-22 22:29 ` Michal Gorlas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acBtQWhiFV2fANAZ@cyber-t14sg4 \
--to=michal.gorlas@9elements.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®