drivers/of: put extended cmdline at the end
authorkszaq <kszaquitto@gmail.com>
Sun, 26 Jun 2016 23:37:55 +0000 (01:37 +0200)
committerNick Xie <nick@khadas.com>
Fri, 12 Jul 2019 05:37:16 +0000 (13:37 +0800)
drivers/of/fdt.c
fs/proc/cmdline.c

index 99779be..09e5460 100644 (file)
@@ -1130,20 +1130,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
                p = of_get_flat_dt_prop(node, "bootargs", &l);
 
        if (p != NULL && l > 0) {
-               if (concat_cmdline) {
-                       int cmdline_len;
-                       int copy_len;
-                       strlcat(cmdline, " ", COMMAND_LINE_SIZE);
-                       cmdline_len = strlen(cmdline);
-                       copy_len = COMMAND_LINE_SIZE - cmdline_len - 1;
-                       copy_len = min((int)l, copy_len);
-                       strncpy(cmdline + cmdline_len, p, copy_len);
-                       cmdline[cmdline_len + copy_len] = '\0';
-               } else {
-                       strlcpy(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
-               }
+               strlcpy(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
        }
 
+       if (concat_cmdline)
+               strlcat(cmdline, config_cmdline, COMMAND_LINE_SIZE);
+
        pr_debug("Command line is: %s\n", (char*)data);
 
        /* break now */
index 1e8f919..c59ed26 100644 (file)
@@ -28,7 +28,7 @@ static ssize_t cmdline_proc_write(struct file *file, const char __user *buf,
           return -EFAULT;
        }
        str[len] = '\0';
-       strlcpy(proc_cmdline, str, min(len, COMMAND_LINE_SIZE));
+       strlcpy(proc_cmdline, str, min((int)len, COMMAND_LINE_SIZE));
 
        return len;
 }