From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bootconfig: Fix to initialize 'ret' local variable
Date: Wed, 27 Oct 2021 23:16:46 +0900 [thread overview]
Message-ID: <20211027231646.cf5333aa08f70fe7f167e4d5@kernel.org> (raw)
In-Reply-To: <20211027100126.58769bf9@gandalf.local.home>
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>
next prev parent reply other threads:[~2021-10-27 14:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 13:54 Masami Hiramatsu
2021-10-27 14:01 ` Steven Rostedt
2021-10-27 14:16 ` Masami Hiramatsu [this message]
2021-10-27 14:19 ` Steven Rostedt
2021-10-27 14:49 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211027231646.cf5333aa08f70fe7f167e4d5@kernel.org \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®