mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Thorsten Blum <blum@kernel.org>
Cc: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Sang-Heon Jeon <ekffu200098@gmail.com>,
	Breno Leitao <leitao@debian.org>,
	Wilson Felipe Pereira <wfelipe@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] init: Use ARRAY_SIZE() in unknown_bootoption()
Date: Tue, 17 Nov 2026 16:40:34 -0800	[thread overview]
Message-ID: <20261117164034.556a3539dafa83c43808692c@linux-foundation.org> (raw)
In-Reply-To: <20261118000037.552633-2-blum@kernel.org>

On Wed, 18 Nov 2026 01:00:36 +0100 Thorsten Blum <blum@kernel.org> wrote:

> Remove the NULL terminator from the bootloader array, make its entries
> const, and use ARRAY_SIZE() as the loop bound. Also reuse the for loop
> index i instead of redeclaring it multiple times.
> 
> ...
>
> --- a/init/main.c
> +++ b/init/main.c
> @@ -576,7 +576,8 @@ static int __init unknown_bootoption(char *param, char *val,
>  	 * 1. LILO/Grub pass "BOOT_IMAGE=...";
>  	 * 2. kexec/kdump (kexec-tools) pass "kexec".
>  	 */
> -	const char *bootloader[] = { "BOOT_IMAGE=", "kexec", NULL };
> +	const char * const bootloader[] = { "BOOT_IMAGE=", "kexec" };

While you're in there,  making this

	static const char * const bootloader[] __initconst = ...

could/should/might put this into .init.rodata so its memory gets
recycled later in boot.



      reply	other threads:[~2026-11-18  0:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  0:00 Thorsten Blum
2026-11-18  0:40 ` Andrew Morton [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=20261117164034.556a3539dafa83c43808692c@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=blum@kernel.org \
    --cc=brauner@kernel.org \
    --cc=ekffu200098@gmail.com \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®