All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Breno Leitao <leitao@debian.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, oss@malat.biz, paulmck@kernel.org,
	rostedt@goodmis.org, kernel-team@meta.com
Subject: Re: [PATCH v2] bootconfig: Apply early options from embedded config
Date: Thu, 26 Mar 2026 23:30:42 +0900	[thread overview]
Message-ID: <20260326233042.f52cfc127ec934d52713bce1@kernel.org> (raw)
In-Reply-To: <20260325232204.05edbb21c7602b6408ca007b@kernel.org>

On Wed, 25 Mar 2026 23:22:04 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> > +	/*
> > +	 * Keys that do not match any early_param() handler are silently
> > +	 * ignored — do_early_param() always returns 0.
> > +	 */
> > +	xbc_node_for_each_key_value(root, knode, val) {
> 
> [sashiko comment]
> | Does this loop handle array values correctly?
> | xbc_node_for_each_key_value() only assigns the first value of an array to
> | the val pointer before advancing to the next key. It does not iterate over
> | the child nodes of the array.
> | If the bootconfig contains a multi-value key like
> | kernel.console = "ttyS0", "tty0", will the subsequent values in the array
> | be silently dropped instead of passed to the early_param handlers?
> 
> Also, good catch :) we need to use xbc_node_for_each_array_value()
> for inner loop.

FYI, xbc_snprint_cmdline() translates the arraied parameter as
multiple parameters. For example,

foo = bar, buz;

will be converted to

foo=bar foo=buz

Thus, I think we should do the same thing below;

> 
> > +		if (xbc_node_compose_key_after(root, knode, xbc_namebuf, XBC_KEYLEN_MAX) < 0)
> > +			continue;
> > +
> > +		/*
> > +		 * We need to copy const char *val to a char pointer,
> > +		 * which is what do_early_param() need, given it might
> > +		 * call strsep(), strtok() later.
> > +		 */
> > +		ret = strscpy(val_buf, val, sizeof(val_buf));
> > +		if (ret < 0) {
> > +			pr_warn("ignoring bootconfig value '%s', too long\n",
> > +				xbc_namebuf);
> > +			continue;
> > +		}
> > +		do_early_param(xbc_namebuf, val_buf, NULL, NULL);

So instead of this;

xbc_array_for_each_value(vnode, val) {
	do_early_param(xbc_namebuf, val, NULL, NULL);
}

Maybe it is a good timing to recondier unifying kernel cmdline and bootconfig
from API viewpoint.

Thanks,

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2026-03-26 14:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 10:05 [PATCH v2] bootconfig: Apply early options from embedded config Breno Leitao
2026-03-25 14:22 ` Masami Hiramatsu
2026-03-26 14:30   ` Masami Hiramatsu [this message]
2026-03-27 10:18     ` Breno Leitao
2026-03-27 14:16       ` Masami Hiramatsu
2026-03-27 16:11         ` Breno Leitao
2026-03-27 10:06   ` Breno Leitao
2026-03-27 13:37     ` Masami Hiramatsu
2026-03-30 13:15       ` Breno Leitao
2026-03-30 15:04         ` Breno Leitao
2026-03-31  3:58           ` Masami Hiramatsu
2026-03-31 15:27             ` Breno Leitao
2026-04-01 13:48               ` Masami Hiramatsu
2026-04-01 15:01                 ` Breno Leitao
2026-04-03  2:45                   ` Masami Hiramatsu
2026-04-07 10:19                     ` Breno Leitao
2026-04-15 11:15                       ` Breno Leitao
2026-04-17  1:46                         ` Masami Hiramatsu
2026-03-31  0:00         ` Masami Hiramatsu
2026-03-31 10:18   ` Kiryl Shutsemau
2026-04-01  1:02     ` Masami Hiramatsu
2026-04-01  9:40       ` Kiryl Shutsemau

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=20260326233042.f52cfc127ec934d52713bce1@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=corbet@lwn.net \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=oss@malat.biz \
    --cc=paulmck@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.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.