lkml.org 
[lkml]   [2021]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] bootconfig: Fix to initialize 'ret' local variable
On Wed, 27 Oct 2021 22:54:28 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:

> Fix xbc_parse_tree() to initialize the 'ret' local variable
> before referring in the loop.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Andrew Morton <akpm@linux-foundation.org>
> Fixes: f3668cde8562 ("bootconfig: Split parse-tree part from xbc_init")
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>

Heh, I just sent the exact same thing. But you have the wrong fixes tag I
believe. As that change just moved the code, but the original location had
the same issue I believe.

I'm fine taking yours instead. But I'd like to update the text explaining
how the ret can be uninitialized and what happens if we set it to zero.

-- Steve


> ---
> lib/bootconfig.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index a10ab25f6fcc..70e0d52ffd24 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -836,7 +836,7 @@ static int __init xbc_verify_tree(void)
> static int __init xbc_parse_tree(void)
> {
> char *p, *q;
> - int ret, c;
> + int ret = 0, c;
>
> last_parent = NULL;
> p = xbc_data;

\
 
 \ /
  Last update: 2021-10-27 16:01    [W:0.038 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site