Skip to content
Commit 39d9c1c1 authored by Steven Rostedt (VMware)'s avatar Steven Rostedt (VMware)
Browse files

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: bdac5c2b

 ("bootconfig: Allocate xbc_data inside xbc_init()")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent d33cc657
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment