lkml.org 
[lkml]   [2020]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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@alum.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

\
 
 \ /
  Last update: 2020-08-03 17:30    [W:0.134 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site