Skip to content

Commit

Permalink
init: bootconfig: Remove all bootconfig data when the init memory is …
Browse files Browse the repository at this point in the history
…removed

Since the bootconfig is used only in the init functions,
it doesn't need to keep the data after boot. Free it when
the init memory is removed.

Link: https://lkml.kernel.org/r/163077084958.222577.5924961258513004428.stgit@devnote2

Signed-off-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
mhiramat authored and rostedt committed Sep 8, 2021
1 parent 4b6b08f commit 40caa12
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,12 @@ static void __init setup_boot_config(void)
return;
}

#else
static void __init exit_boot_config(void)
{
xbc_destroy_all();
}

#else /* !CONFIG_BOOT_CONFIG */

static void __init setup_boot_config(void)
{
Expand All @@ -481,7 +486,11 @@ static int __init warn_bootconfig(char *str)
pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
return 0;
}
#endif

#define exit_boot_config() do {} while (0)

#endif /* CONFIG_BOOT_CONFIG */

early_param("bootconfig", warn_bootconfig);

/* Change NUL term back to "=", to make "param" the whole string. */
Expand Down Expand Up @@ -1493,6 +1502,7 @@ static int __ref kernel_init(void *unused)
kprobe_free_init_mem();
ftrace_free_init_mem();
kgdb_free_init_mem();
exit_boot_config();
free_initmem();
mark_readonly();

Expand Down

0 comments on commit 40caa12

Please sign in to comment.