Re: [RFC PATCH 1/5] bootconfig: Add multi-config ID helpers and xbc_init_configs() support

From
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date
2026-11-29 00:47:59
Reply to
sashiko-bot@kernel.org, 2026-11-27
On Fri, 27 Nov 2026 15:02:18 +0000, sashiko-bot@kernel.org [off-list ref] wrote:
[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.
Oops, good catch! Yes, that should be a problem. Let's check the unclosed
brace position and config boundary (offset).

Thank you,

-- 
Masami Hiramatsu (Google) [off-list ref]
Thread (10 messages) 10 messages, 2 authors, last reply 20h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help