Skip to content

Commit

Permalink
bootconfig: Fix missing return check of xbc_node_compose_key function
Browse files Browse the repository at this point in the history
commit 903bd06 upstream.

The function `xbc_show_list should` handle the keys during the
composition. Even the errors returned by the compose function. Instead
of removing the `ret` variable, it should save the value and show the
exact error. This missing variable is causing a compilation issue also.

Link: https://lkml.kernel.org/r/163077087861.222577.12884543474750968146.stgit@devnote2

Fixes: e5efaeb ("bootconfig: Support mixing a value and subkeys under a key")
Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jcfaracco authored and gregkh committed Sep 15, 2021
1 parent fbc0d19 commit ac16137
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/bootconfig/main.c
Expand Up @@ -111,9 +111,11 @@ static void xbc_show_list(void)
char key[XBC_KEYLEN_MAX];
struct xbc_node *leaf;
const char *val;
int ret;

xbc_for_each_key_value(leaf, val) {
if (xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX) < 0) {
ret = xbc_node_compose_key(leaf, key, XBC_KEYLEN_MAX);
if (ret < 0) {
fprintf(stderr, "Failed to compose key %d\n", ret);
break;
}
Expand Down

0 comments on commit ac16137

Please sign in to comment.