diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-04-10 19:42:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-04-10 19:42:45 -0700 |
commit | 03a55b63919f4b52b9c323d9a43ccccdc1cdb33b (patch) | |
tree | 706e446ce39c2db9d7b88eaf09938fb222b67791 | |
parent | 9875c0beb8adaab602572b983fb59dbd761d5882 (diff) | |
parent | c722cea208789d9e2660992bcd05fb9fac3adb56 (diff) | |
download | linux-03a55b63919f4b52b9c323d9a43ccccdc1cdb33b.tar.gz |
Merge tag 'bootconfig-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull bootconfig fixes from Masami Hiramatsu:
- show the original cmdline only once, and only if it was modeified by
bootconfig
* tag 'bootconfig-fixes-v6.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
fs/proc: Skip bootloader comment if no embedded kernel parameters
fs/proc: remove redundant comments from /proc/bootconfig
-rw-r--r-- | fs/proc/bootconfig.c | 12 | ||||
-rw-r--r-- | include/linux/bootconfig.h | 1 | ||||
-rw-r--r-- | init/main.c | 5 |
3 files changed, 12 insertions, 6 deletions
diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c index 902b326e1e5607..87dcaae32ff87b 100644 --- a/fs/proc/bootconfig.c +++ b/fs/proc/bootconfig.c @@ -62,12 +62,12 @@ static int __init copy_xbc_key_value_list(char *dst, size_t size) break; dst += ret; } - if (ret >= 0 && boot_command_line[0]) { - ret = snprintf(dst, rest(dst, end), "# Parameters from bootloader:\n# %s\n", - boot_command_line); - if (ret > 0) - dst += ret; - } + } + if (cmdline_has_extra_options() && ret >= 0 && boot_command_line[0]) { + ret = snprintf(dst, rest(dst, end), "# Parameters from bootloader:\n# %s\n", + boot_command_line); + if (ret > 0) + dst += ret; } out: kfree(key); diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h index ca73940e26df83..e5ee2c694401e0 100644 --- a/include/linux/bootconfig.h +++ b/include/linux/bootconfig.h @@ -10,6 +10,7 @@ #ifdef __KERNEL__ #include <linux/kernel.h> #include <linux/types.h> +bool __init cmdline_has_extra_options(void); #else /* !__KERNEL__ */ /* * NOTE: This is only for tools/bootconfig, because tools/bootconfig will diff --git a/init/main.c b/init/main.c index 2ca52474d0c303..881f6230ee59e9 100644 --- a/init/main.c +++ b/init/main.c @@ -487,6 +487,11 @@ static int __init warn_bootconfig(char *str) early_param("bootconfig", warn_bootconfig); +bool __init cmdline_has_extra_options(void) +{ + return extra_command_line || extra_init_args; +} + /* Change NUL term back to "=", to make "param" the whole string. */ static void __init repair_env_string(char *param, char *val) { |