* [PATCH] bootconfig: Fix to initialize 'ret' local variable
@ 2021-10-27 13:54 Masami Hiramatsu
2021-10-27 14:01 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2021-10-27 13:54 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Andrew Morton, linux-kernel
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>
---
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bootconfig: Fix to initialize 'ret' local variable
2021-10-27 13:54 [PATCH] bootconfig: Fix to initialize 'ret' local variable Masami Hiramatsu
@ 2021-10-27 14:01 ` Steven Rostedt
2021-10-27 14:16 ` Masami Hiramatsu
0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2021-10-27 14:01 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Andrew Morton, linux-kernel
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bootconfig: Fix to initialize 'ret' local variable
2021-10-27 14:01 ` Steven Rostedt
@ 2021-10-27 14:16 ` Masami Hiramatsu
2021-10-27 14:19 ` Steven Rostedt
0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2021-10-27 14:16 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Andrew Morton, linux-kernel
On Wed, 27 Oct 2021 10:01:26 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> 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.
No, the original code uses the 'ret' for checking strlen().
+int __init xbc_init(char *buf)
+{
+ char *p, *q;
+ int ret, c;
+
+ if (xbc_data)
+ return -EBUSY;
+
+ ret = strlen(buf);
+ if (ret > XBC_DATA_MAX - 1 || ret == 0)
+ return -ERANGE;
+
OK, but my tag is also wrong, since this strlen() has been removed by
commit bdac5c2b243f ("bootconfig: Allocate xbc_data inside xbc_init()")
So the correct tag is
Fixes: bdac5c2b243f ("bootconfig: Allocate xbc_data inside xbc_init()")
>
> 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.
Yeah, I'm also good for both, but the Fixes tag must be updated.
Thank you,
>
> -- 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;
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bootconfig: Fix to initialize 'ret' local variable
2021-10-27 14:16 ` Masami Hiramatsu
@ 2021-10-27 14:19 ` Steven Rostedt
2021-10-27 14:49 ` Masami Hiramatsu
0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2021-10-27 14:19 UTC (permalink / raw)
To: Masami Hiramatsu; +Cc: Andrew Morton, linux-kernel
On Wed, 27 Oct 2021 23:16:46 +0900
Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > 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.
>
> Yeah, I'm also good for both, but the Fixes tag must be updated.
OK, I'll take mine then and update the fixes tag. Care to reply with a
Reviewed-by tag?
Thanks,
-- Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bootconfig: Fix to initialize 'ret' local variable
2021-10-27 14:19 ` Steven Rostedt
@ 2021-10-27 14:49 ` Masami Hiramatsu
0 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2021-10-27 14:49 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Andrew Morton, linux-kernel
On Wed, 27 Oct 2021 10:19:09 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 27 Oct 2021 23:16:46 +0900
> Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> > >
> > > 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.
> >
> > Yeah, I'm also good for both, but the Fixes tag must be updated.
>
> OK, I'll take mine then and update the fixes tag. Care to reply with a
> Reviewed-by tag?
Yes, sure, I sent it:)
>
> Thanks,
>
> -- Steve
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-27 14:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 13:54 [PATCH] bootconfig: Fix to initialize 'ret' local variable Masami Hiramatsu
2021-10-27 14:01 ` Steven Rostedt
2021-10-27 14:16 ` Masami Hiramatsu
2021-10-27 14:19 ` Steven Rostedt
2021-10-27 14:49 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®