summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorYuntao Wang <ytcoode@gmail.com>2024-04-12 19:02:08 +0300
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2024-04-12 19:02:08 +0300
commitcd24bdb06820d12dc84aeb0a47a10ad7ecf4b027 (patch)
tree950579547b3fabdc13bd676a6460db2f275b632a /init
parentefee03a50c2844d78f6fb5e98be1ffd17605dc5b (diff)
downloadlinux-cd24bdb06820d12dc84aeb0a47a10ad7ecf4b027.tar.xz
init/main.c: Remove redundant space from saved_command_line
There is a space at the end of extra_init_args. In the current logic, copying extra_init_args to saved_command_line will cause extra spaces in saved_command_line here or there. Remove the trailing space from extra_init_args to make the string in saved_command_line look more perfect. Link: https://lore.kernel.org/all/20240412032950.12687-1-ytcoode@gmail.com/ Signed-off-by: Yuntao Wang <ytcoode@gmail.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'init')
-rw-r--r--init/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/init/main.c b/init/main.c
index 96e59e5761ff..02156c3c5879 100644
--- a/init/main.c
+++ b/init/main.c
@@ -628,8 +628,10 @@ 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;