Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
init/main.c: Remove redundant space from saved_command_line
Browse files Browse the repository at this point in the history
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/[email protected]/

Signed-off-by: Yuntao Wang <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
  • Loading branch information
ytcoode authored and mhiramat committed Apr 12, 2024
1 parent efee03a commit cd24bdb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit cd24bdb

Please sign in to comment.