[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200803152959.GA1168816@rani.riverdale.lan>
Date: Mon, 3 Aug 2020 11:29:59 -0400
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Arvind Sankar <nivedita@...m.mit.edu>,
Steven Rostedt <rostedt@...dmis.org>,
Kees Cook <keescook@...omium.org>,
Ingo Molnar <mingo@...hat.com>,
Frank Rowand <frowand.list@...il.com>,
Randy Dunlap <rdunlap@...radead.org>,
Namhyung Kim <namhyung@...nel.org>,
Tim Bird <Tim.Bird@...y.com>, Jiri Olsa <jolsa@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Tom Zanussi <tom.zanussi@...ux.intel.com>,
Rob Herring <robh+dt@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Jonathan Corbet <corbet@....net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-doc@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 08/22] bootconfig: init: Allow admin to use bootconfig
for init command line
On Tue, Aug 04, 2020 at 12:03:45AM +0900, Masami Hiramatsu wrote:
> On Sat, 1 Aug 2020 22:33:18 -0400
> Arvind Sankar <nivedita@...m.mit.edu> wrote:
> >
> > I came across this as I was poking around some of the command line
> > parsing. AFAICT, initargs_found will never be set to true here, because
> > parse_args handles "--" itself by immediately returning: it doesn't
> > invoke the callback for it. So you'd instead have to check the return of
> > parse_args("bootconfig"...) to detect the initargs_found case.
>
> Oops, good catch!
> Does this fixes the problem?
Note I found the issue by code inspection, I don't have an actual test
case. But the change looks good to me, with one comment below.
>
> strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
> - parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
> - bootconfig_params);
> + err = parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
> + bootconfig_params);
>
> - if (!bootconfig_found)
> + if (IS_ERR(err) || !bootconfig_found)
> return;
>
> + /* parse_args() stops at '--' and returns an address */
> + if (!IS_ERR(err) && err)
> + initargs_found = true;
> +
I think you can drop the second IS_ERR, since we already checked that.
> if (!data) {
> pr_err("'bootconfig' found on command line, but no bootconfig found\n");
> return;
> --
> 2.25.1
Powered by blists - more mailing lists