]> git.baikalelectronics.ru Git - kernel.git/commit
bootconfig: Initialize ret in xbc_parse_tree()
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 27 Oct 2021 14:57:53 +0000 (10:57 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 27 Oct 2021 15:22:09 +0000 (11:22 -0400)
commitbe50290c5bf511c96e6e9f14ffa981d44a82f9e8
tree2de687f25668ad608a8ad61ba484620ebe2b56db
parent5e79095296536d9f9ca42b6e6dba2186fe4eb8e9
bootconfig: Initialize ret in xbc_parse_tree()

The do while loop continues while ret is zero, but ret is never
initialized. The check for ret in the loop at the while should always be
initialized, but if an empty string were to be passed in, q would be NULL
and p would be '\0', and it would break out of the loop without ever
setting ret.

Set ret to zero, and then xbc_verify_tree() would be called and catch that
it is an empty tree and report the proper error.

Link: https://lkml.kernel.org/r/20211027105753.6ab9da5f@gandalf.local.home
Fixes: 4b2aa002f159 ("bootconfig: Allocate xbc_data inside xbc_init()")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
lib/bootconfig.c