diff options
| author | Breno Leitao <leitao@debian.org> | 2026-07-02 21:15:44 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-07-02 21:15:44 +0900 |
| commit | 7afe198fc1edffcda3bc82b13eed2e5f576b60a4 (patch) | |
| tree | 4c62690c944c277b28385cd18da631360bf39dbc /init | |
| parent | 4a50a141f05a8d1737661b19ee22ff8455b94409 (diff) | |
| download | linux-7afe198fc1edffcda3bc82b13eed2e5f576b60a4.tar.gz linux-7afe198fc1edffcda3bc82b13eed2e5f576b60a4.zip | |
bootconfig: render descendant keys when xbc_snprint_cmdline() root has a value
xbc_node_for_each_key_value() walks to the first leaf under @root, and
when @root is itself a leaf it yields @root. That happens not only for
an empty "kernel {}" subtree, but also when @root carries both a value
and subkeys, e.g.
kernel = x
kernel.foo = bar
Here @root ("kernel") is a leaf because its first child is the value
node "x", so the iterator returns @root first. Feeding @root back into
xbc_node_compose_key_after(root, root) returns -EINVAL, which the only
in-kernel caller papers over with a "len <= 0" check -- but the
follow-up tools/bootconfig -C user propagates the error and turns such
a bootconfig into a build failure. Worse, short-circuiting the whole
call on a leaf @root would silently drop the valid "kernel.foo = bar"
descendant that this patch should render.
Skip @root inside the loop instead of bailing out: the value-only entry
is dropped (it is rendered through the "kernel" cmdline path, not here),
while real descendant keys are still emitted. An entirely empty subtree
now renders nothing and returns 0 rather than -EINVAL, matching the
"nothing to render is not an error" semantics expected by the new
build-time caller.
Link: https://lore.kernel.org/all/20260626-bootconfig_using_tools-v7-2-24ab72139c29@debian.org/
Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions
