linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yuntao Wang <ytcoode@gmail.com>
To: mhiramat@kernel.org
Cc: akpm@linux-foundation.org, arnd@arndb.de, changbin.du@huawei.com,
	christophe.leroy@csgroup.eu, geert@linux-m68k.org,
	jpoimboe@kernel.org, kjlx@templeofstupid.com,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	ndesaulniers@google.com, peterz@infradead.org,
	tglx@linutronix.de, tj@kernel.org, ytcoode@gmail.com
Subject: [PATCH v2] init/main.c: Remove redundant space from saved_command_line
Date: Fri, 12 Apr 2024 11:29:50 +0800	[thread overview]
Message-ID: <20240412032950.12687-1-ytcoode@gmail.com> (raw)
In-Reply-To: <20240412080839.c903a0058bd6594d31bc1d3e@kernel.org>

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.

Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
v1 -> v2: Fix the issue using the method suggested by Masami

 init/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 881f6230ee59..0f03dd15e0e2 100644
--- a/init/main.c
+++ b/init/main.c
@@ -627,8 +627,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;
 
-- 
2.44.0


  parent reply	other threads:[~2024-04-12  3:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240411041200.225356-1-ytcoode@gmail.com>
     [not found] ` <CAMuHMdU1-F0eZAXUyVCt2ik2w9J+vTm1DnvTVwx2hNz1CDZc1g@mail.gmail.com>
2024-04-11 14:07   ` [PATCH] init/main.c: Remove redundant space from saved_command_line 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         ` Yuntao Wang [this message]
2024-04-12  5:18           ` [PATCH v2] " Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412032950.12687-1-ytcoode@gmail.com \
    --to=ytcoode@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=changbin.du@huawei.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=geert@linux-m68k.org \
    --cc=jpoimboe@kernel.org \
    --cc=kjlx@templeofstupid.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).