The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] init/main.c: Remove redundant space from saved_command_line
@ 2024-04-11  4:12 Yuntao Wang
  2024-04-11  7:18 ` Geert Uytterhoeven
  2024-04-11  7:19 ` Geert Uytterhoeven
  0 siblings, 2 replies; 9+ messages in thread
From: Yuntao Wang @ 2024-04-11  4:12 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Gleixner, Peter Zijlstra (Intel), Andrew Morton,
	Josh Poimboeuf, ndesaulniers@google.com, Tejun Heo,
	Christophe Leroy, Krister Johansen, Changbin Du, Arnd Bergmann,
	Geert Uytterhoeven, Yuntao Wang

extra_init_args ends with a space, so when concatenating extra_init_args
to saved_command_line, be sure to remove the extra space.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
 init/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 2ca52474d0c3..cf2c22aa0e8c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -660,12 +660,14 @@ static void __init setup_command_line(char *command_line)
 			strcpy(saved_command_line + len, extra_init_args);
 			len += ilen - 4;	/* strlen(extra_init_args) */
 			strcpy(saved_command_line + len,
-				boot_command_line + initargs_offs - 1);
+				boot_command_line + initargs_offs);
 		} else {
 			len = strlen(saved_command_line);
 			strcpy(saved_command_line + len, " -- ");
 			len += 4;
 			strcpy(saved_command_line + len, extra_init_args);
+			len += ilen - 4; /* strlen(extra_init_args) */
+			saved_command_line[len-1] = '\0'; /* remove trailing space */
 		}
 	}
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-04-12  5:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11  4:12 [PATCH] init/main.c: Remove redundant space from saved_command_line Yuntao Wang
2024-04-11  7:18 ` Geert Uytterhoeven
2024-04-11  7:19 ` Geert Uytterhoeven
2024-04-11 14:07   ` Masami Hiramatsu
2024-04-11 15:29     ` Yuntao Wang
2024-04-11 23:08       ` Masami Hiramatsu
2024-04-12  1:46         ` Yuntao Wang
2024-04-12  3:29         ` [PATCH v2] " Yuntao Wang
2024-04-12  5:18           ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox