Bootconfig updates for v6.10:

- Do not put unneeded quotes on the extra command line items which was
   inserted from the bootconfig.
 - Remove redundant spaces from the extra command line.
 -----BEGIN PGP SIGNATURE-----
 
 iQFPBAABCgA5FiEEh7BulGwFlgAOi5DV2/sHvwUrPxsFAmZGkuobHG1hc2FtaS5o
 aXJhbWF0c3VAZ21haWwuY29tAAoJENv7B78FKz8bVEsH/iMoyjutOElICR0gapcR
 i2fd+iDlIzTgHhVSGt8qkQAdclNt/9P2xSfnvk9Z2SImZBlx6oGwVi32fRxky7R2
 vZ+vPX1WDMwxHbZl+CCwGhJJQ6n5d1u0rtgY2g4h18Er1vMK8Vo+1T3SCkEOqtxs
 J4vfeYo9EOgdx2BA/De5GwpNrowrmdPn0TqSmjZlB7BqY8UY4a4x3Y2CeS8n5n2C
 hnfkQ0kwbvNtsOEmRKeF9OROpBVVmlTExi8KzaH7shhCHbhIZD9froo2ZwSaCS8L
 79+mDkyt3YcQKarVNKnH7wa0WvCEZYgVH+oZ6uUDhsP1m+L+d3BdNbDEEUPUpnjB
 VnY=
 =e4Ys
 -----END PGP SIGNATURE-----

Merge tag 'bootconfig-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull bootconfig updates from Masami Hiramatsu:

 - Do not put unneeded quotes on the extra command line items which was
   inserted from the bootconfig.

 - Remove redundant spaces from the extra command line.

* tag 'bootconfig-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  init/main.c: Minor cleanup for the setup_command_line() function
  init/main.c: Remove redundant space from saved_command_line
  bootconfig: do not put quotes on cmdline items unless necessary
This commit is contained in:
Linus Torvalds 2024-05-17 18:23:55 -07:00
commit e9d6825180

View File

@ -327,7 +327,7 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size,
{
struct xbc_node *knode, *vnode;
char *end = buf + size;
const char *val;
const char *val, *q;
int ret;
xbc_node_for_each_key_value(root, knode, val) {
@ -345,8 +345,9 @@ static int __init xbc_snprint_cmdline(char *buf, size_t size,
continue;
}
xbc_array_for_each_value(vnode, val) {
ret = snprintf(buf, rest(buf, end), "%s=\"%s\" ",
xbc_namebuf, val);
q = strpbrk(val, " \t\r\n") ? "\"" : "";
ret = snprintf(buf, rest(buf, end), "%s=%s%s%s ",
xbc_namebuf, q, val, q);
if (ret < 0)
return ret;
buf += ret;
@ -627,14 +628,16 @@ static void __init setup_command_line(char *command_line)
if (extra_command_line)
xlen = strlen(extra_command_line);
if (extra_init_args)
if (extra_init_args) {
extra_init_args = strim(extra_init_args); /* remove trailing space */
ilen = strlen(extra_init_args) + 4; /* for " -- " */
}
len = xlen + strlen(boot_command_line) + 1;
len = xlen + strlen(boot_command_line) + ilen + 1;
saved_command_line = memblock_alloc(len + ilen, SMP_CACHE_BYTES);
saved_command_line = memblock_alloc(len, SMP_CACHE_BYTES);
if (!saved_command_line)
panic("%s: Failed to allocate %zu bytes\n", __func__, len + ilen);
panic("%s: Failed to allocate %zu bytes\n", __func__, len);
len = xlen + strlen(command_line) + 1;