]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
lib/bootconfig: fix off-by-one in xbc_verify_tree() unclosed brace error
authorJosh Law <objecting@objecting.org>
Thu, 12 Mar 2026 19:11:41 +0000 (19:11 +0000)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 13 Mar 2026 01:29:21 +0000 (10:29 +0900)
commit39ebc8d7f561e1b64eca87353ef9b18e2825e591
treea9fdee2ae1c738549f1f0698c52f684b5629ff78
parent1f318b96cc84d7c2ab792fcc0bfd42a7ca890681
lib/bootconfig: fix off-by-one in xbc_verify_tree() unclosed brace error

__xbc_open_brace() pushes entries with post-increment
(open_brace[brace_index++]), so brace_index always points one past
the last valid entry.  xbc_verify_tree() reads open_brace[brace_index]
to report which brace is unclosed, but this is one past the last
pushed entry and contains stale/zero data, causing the error message
to reference the wrong node.

Use open_brace[brace_index - 1] to correctly identify the unclosed
brace.  brace_index is known to be > 0 here since we are inside the
if (brace_index) guard.

Link: https://lore.kernel.org/all/20260312191143.28719-2-objecting@objecting.org/
Fixes: ead1e19ad905 ("lib/bootconfig: Fix a bug of breaking existing tree nodes")
Cc: stable@vger.kernel.org
Signed-off-by: Josh Law <objecting@objecting.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
lib/bootconfig.c