All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	Breno Leitao <leitao@debian.org>,
	Sang-Heon Jeon <ekffu200098@gmail.com>,
	Christian Brauner <brauner@kernel.org>,
	Wilson Felipe Pereira <wfelipe@google.com>,
	Ryan Roberts <ryan.roberts@arm.com>
Cc: Thorsten Blum <blum@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] init: Use kmalloc() in do_initcalls()
Date: Sat, 14 Nov 2026 12:52:30 +0100	[thread overview]
Message-ID: <20261114115230.30345-4-blum@kernel.org> (raw)
In-Reply-To: <20261114115230.30345-3-blum@kernel.org>

Use kmalloc() since strscpy() already NUL-terminates command_line.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 init/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/main.c b/init/main.c
index 93a2b12976f0..7f52a1b00c0f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1475,7 +1475,7 @@ static void __init do_initcalls(void)
 	size_t len = saved_command_line_len + 1;
 	char *command_line;
 
-	command_line = kzalloc(len, GFP_KERNEL);
+	command_line = kmalloc(len, GFP_KERNEL);
 	if (!command_line)
 		panic("%s: Failed to allocate %zu bytes\n", __func__, len);
 

      reply	other threads:[~2026-11-14 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 11:52 [PATCH 1/2] init: Use strscpy() in do_initcalls() Thorsten Blum
2026-11-14 11:52 ` Thorsten Blum [this message]

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=20261114115230.30345-4-blum@kernel.org \
    --to=blum@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=ekffu200098@gmail.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=wfelipe@google.com \
    /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.