Commit e9d68251 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 91b6163b ddd53363
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment