All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuntao Wang <ytcoode@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	"ndesaulniers@google.com" <ndesaulniers@google.com>,
	Tejun Heo <tj@kernel.org>,
	Christophe Leroy <christophe.leroy@csgroup.eu>,
	Krister Johansen <kjlx@templeofstupid.com>,
	Changbin Du <changbin.du@huawei.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Yuntao Wang <ytcoode@gmail.com>
Subject: [PATCH] init/main.c: Remove redundant space from saved_command_line
Date: Thu, 11 Apr 2024 12:12:00 +0800	[thread overview]
Message-ID: <20240411041200.225356-1-ytcoode@gmail.com> (raw)

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


             reply	other threads:[~2024-04-11  4:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  4:12 Yuntao Wang [this message]
2024-04-11  7:18 ` [PATCH] init/main.c: Remove redundant space from saved_command_line 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

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=20240411041200.225356-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+renesas@glider.be \
    --cc=jpoimboe@kernel.org \
    --cc=kjlx@templeofstupid.com \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.