]> Git Repo - J-linux.git/commitdiff
Merge tag 'bootconfig-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
authorLinus Torvalds <[email protected]>
Sat, 18 May 2024 01:23:55 +0000 (18:23 -0700)
committerLinus Torvalds <[email protected]>
Sat, 18 May 2024 01:23:55 +0000 (18:23 -0700)
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

1  2 
init/main.c

diff --combined init/main.c
index f4e6001ebe79fcdff84769f926a478d0c40908c7,383796015113e4a5f8858a7b8d15c29b2f6dea41..91e74827f858939ae03c7778a3399aa2e5a2c2c0
@@@ -327,7 -327,7 +327,7 @@@ static int __init xbc_snprint_cmdline(c
  {
        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) {
                        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 +628,16 @@@ static void __init setup_command_line(c
  
        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;
  
@@@ -1415,7 -1418,6 +1418,7 @@@ static void mark_readonly(void
                 * insecure pages which are W+X.
                 */
                flush_module_init_free_work();
 +              jump_label_init_ro();
                mark_rodata_ro();
                debug_checkwx();
                rodata_test();
This page took 0.067765 seconds and 4 git commands to generate.