From: Yuntao Wang <ytcoode@gmail.com>
To: mhiramat@kernel.org
Cc: akpm@linux-foundation.org, arnd@arndb.de,
christophe.leroy@csgroup.eu, geert@linux-m68k.org,
jpoimboe@kernel.org, kjlx@templeofstupid.com,
linux-kernel@vger.kernel.org, ndesaulniers@google.com,
peterz@infradead.org, rppt@kernel.org, tglx@linutronix.de,
tj@kernel.org, ytcoode@gmail.com
Subject: [PATCH v2 2/2] init/main.c: Minor cleanup for the setup_command_line() function
Date: Fri, 12 Apr 2024 16:17:33 +0800 [thread overview]
Message-ID: <20240412081733.35925-3-ytcoode@gmail.com> (raw)
In-Reply-To: <20240412081733.35925-1-ytcoode@gmail.com>
This is just a minor cleanup to make the code look a bit cleaner.
Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
---
init/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/init/main.c b/init/main.c
index 5dcf5274c09c..d6383e397e9f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -630,11 +630,11 @@ static void __init setup_command_line(char *command_line)
if (extra_init_args)
ilen = strlen(extra_init_args) + 4; /* for " -- " */
- len = xlen + strlen(boot_command_line) + 1;
+ len = xlen + strlen(boot_command_line) + ilen + 1;
- saved_command_line = memblock_alloc(len + ilen, SMP_CACHE_BYTES);
+ saved_command_line = memblock_alloc(len, SMP_CACHE_BYTES);
if (!saved_command_line)
- panic("%s: Failed to allocate %zu bytes\n", __func__, len + ilen);
+ panic("%s: Failed to allocate %zu bytes\n", __func__, len);
len = xlen + strlen(command_line) + 1;
--
2.44.0
next prev parent reply other threads:[~2024-04-12 8:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 3:21 [PATCH] init/main.c: Fix potential static_command_line memory overflow Yuntao Wang
2024-04-11 7:23 ` Geert Uytterhoeven
2024-04-11 13:21 ` Mike Rapoport
2024-04-11 14:27 ` Yuntao Wang
2024-04-11 15:08 ` Masami Hiramatsu
2024-04-11 15:47 ` Yuntao Wang
2024-04-12 3:51 ` Yuntao Wang
2024-04-12 5:15 ` Masami Hiramatsu
2024-04-12 8:17 ` [PATCH v2 0/2] " Yuntao Wang
2024-04-12 8:17 ` [PATCH v2 1/2] init/main.c: " Yuntao Wang
2024-04-12 8:17 ` Yuntao Wang [this message]
2024-04-12 15:58 ` [PATCH v2 0/2] " Masami Hiramatsu
2024-04-11 14:29 ` [PATCH] init/main.c: " Masami Hiramatsu
2024-04-11 14:59 ` Yuntao Wang
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=20240412081733.35925-3-ytcoode@gmail.com \
--to=ytcoode@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--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=mhiramat@kernel.org \
--cc=ndesaulniers@google.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.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