mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
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: bdac5c2b24
("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>
This commit is contained in:
parent
d33cc65737
commit
39d9c1c103
|
@ -836,7 +836,7 @@ static int __init xbc_verify_tree(void)
|
||||||
static int __init xbc_parse_tree(void)
|
static int __init xbc_parse_tree(void)
|
||||||
{
|
{
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
int ret, c;
|
int ret = 0, c;
|
||||||
|
|
||||||
last_parent = NULL;
|
last_parent = NULL;
|
||||||
p = xbc_data;
|
p = xbc_data;
|
||||||
|
|
Loading…
Reference in a new issue