Skip to content

Commit

Permalink
bootconfig: Fix to prevent warning message if no bootconfig option
Browse files Browse the repository at this point in the history
Commit de462e5 ("bootconfig: Fix to remove bootconfig
data from initrd while boot") causes a cosmetic regression
on dmesg, which warns "no bootconfig data" message without
bootconfig cmdline option.

Fix setup_boot_config() by moving no bootconfig check after
commandline option check.

Link: http://lkml.kernel.org/r/9b1ba335-071d-c983-89a4-2677b522dcc8@molgen.mpg.de
Link: http://lkml.kernel.org/r/158916116468.21787.14558782332170588206.stgit@devnote2

Fixes: de462e5 ("bootconfig: Fix to remove bootconfig data from initrd while boot")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
mhiramat authored and rostedt committed May 12, 2020
1 parent 8b1fac2 commit 611d0a9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline)
char *data, *copy;
int ret;

/* Cut out the bootconfig data even if we have no bootconfig option */
data = get_boot_config_from_initrd(&size, &csum);
if (!data)
goto not_found;

strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
Expand All @@ -411,6 +410,11 @@ static void __init setup_boot_config(const char *cmdline)
if (!bootconfig_found)
return;

if (!data) {
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
return;
}

if (size >= XBC_DATA_MAX) {
pr_err("bootconfig size %d greater than max size %d\n",
size, XBC_DATA_MAX);
Expand Down Expand Up @@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline)
extra_init_args = xbc_make_cmdline("init");
}
return;
not_found:
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
}

#else
Expand Down

0 comments on commit 611d0a9

Please sign in to comment.