All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] bootconfig: Add multi-config ID helpers and xbc_init_configs() support
Date: Fri, 27 Nov 2026 15:02:18 +0000	[thread overview]
Message-ID: <sashiko-outbox-237662@kernel.org> (raw)
In-Reply-To: <20261127144614.61194-2-mhiramat@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] bootconfig: unclosed brace on reused key misattributed in
  xbc_init_configs()
--

commit 9ef6591953493a8a81a45580cc486a9c5b6fe288
Author: Masami Hiramatsu (Google) <mhiramat@kernel.org>

bootconfig: Add multi-config ID helpers and xbc_init_configs() support

This commit adds helpers for parsing and selecting named bootconfig blocks
and introduces xbc_init_configs() to concatenate and parse multiple enabled
configs into a single XBC tree.

> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 9ae9a215b1da3..fe27e72c9ee54 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
[ ... ]
> @@ -1134,12 +1129,219 @@ static int __init xbc_parse_tree(void)
>  	} while (!ret);
>  
>  	if (!ret) {
> -		while (p < xbc_data + xbc_data_size - 1 && *p == '\0')
> +		while (p < data + size && *p == '\0')
>  			p++;
> -		if (p < xbc_data + xbc_data_size - 1)
> +		if (p < data + size)
>  			ret = xbc_parse_error("Unexpected data after null character", p);
>  	}
>  
> +	if (!ret && brace_index) {
> +		n = &xbc_nodes[open_brace[brace_index - 1]];
> +		ret = xbc_parse_error("Brace is not closed",
> +				      xbc_node_get_data(n));
> +	}
> +
>  	return ret;
>  }

[Severity: Medium]
Can an unclosed brace in a later config be misattributed to an earlier
config in xbc_init_configs()?

When a subsequent config reopens a key that was already defined in an
earlier config (for example, top-level "kernel {") and omits the closing
brace, __xbc_add_key() reuses the existing struct xbc_node from the
earlier config without updating node->data:

lib/bootconfig.c:__xbc_add_key() {
	...
	node = find_match_node(node, data);
	if (node) {
		last_parent = node;
	} else {
	...
}

Because xbc_node_get_data(n) still points into the earlier config's slice
of xbc_data, xbc_parse_error() sets xbc_err_pos to an offset within that
earlier slice.  The error-mapping loop in xbc_init_configs() then reports
the earlier config's index in *err_idx and its offset in *epos instead of
blaming the config that left the brace unclosed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127144614.61194-1-mhiramat@kernel.org?part=1

  reply	other threads:[~2026-11-27 15:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 14:46 [RFC PATCH 0/5] bootconfig: Support multiple named bootconfigs in initrd Masami Hiramatsu (Google)
2026-11-27 14:46 ` [RFC PATCH 1/5] bootconfig: Add multi-config ID helpers and xbc_init_configs() support Masami Hiramatsu (Google)
2026-11-27 15:02   ` sashiko-bot [this message]
2026-11-29  0:47     ` Masami Hiramatsu (Google)
2026-11-27 14:46 ` [RFC PATCH 2/5] bootconfig: Support stacked initrd bootconfigs and bootconfig= selection Masami Hiramatsu (Google)
2026-11-27 15:11   ` sashiko-bot
2026-11-29  1:27     ` Masami Hiramatsu (Google)
2026-11-27 14:46 ` [RFC PATCH 3/5] tools/bootconfig: Support multiple named bootconfigs with -i option Masami Hiramatsu (Google)
2026-11-27 14:46 ` [RFC PATCH 4/5] selftests/ftrace: Add boottime tests for multiple bootconfig selection Masami Hiramatsu (Google)
2026-11-27 14:46 ` [RFC PATCH 5/5] Documentation: bootconfig: Document multiple bootconfigs and selection Masami Hiramatsu (Google)

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=sashiko-outbox-237662@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.