[GIT PULL] bootconfig: Fixes for v6.9-rc3

Masami Hiramatsu (Google) posted 1 patch 1 year, 10 months ago
fs/proc/bootconfig.c       | 12 ++++++------
include/linux/bootconfig.h |  1 +
init/main.c                |  5 +++++
3 files changed, 12 insertions(+), 6 deletions(-)
[GIT PULL] bootconfig: Fixes for v6.9-rc3
Posted by Masami Hiramatsu (Google) 1 year, 10 months ago
Hi Linus,

Bootconfig fixes for v6.9-rc3:

- fs/proc: Fix to not show original kernel cmdline more than twice on
  /proc/bootconfig.
- fs/proc: Fix to show the original cmdline only if the bootconfig
  modifies it.


Please pull the latest bootconfig-fixes-v6.9-rc3 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
bootconfig-fixes-v6.9-rc3

Tag SHA1: b0066d569a0eed92657edc836868122a6761da49
Head SHA1: c722cea208789d9e2660992bcd05fb9fac3adb56


Masami Hiramatsu (1):
      fs/proc: Skip bootloader comment if no embedded kernel parameters

Zhenhua Huang (1):
      fs/proc: remove redundant comments from /proc/bootconfig

----
 fs/proc/bootconfig.c       | 12 ++++++------
 include/linux/bootconfig.h |  1 +
 init/main.c                |  5 +++++
 3 files changed, 12 insertions(+), 6 deletions(-)
---------------------------
diff --git a/fs/proc/bootconfig.c b/fs/proc/bootconfig.c
index 902b326e1e56..87dcaae32ff8 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 ca73940e26df..e5ee2c694401 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 2ca52474d0c3..881f6230ee59 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)
 {

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [GIT PULL] bootconfig: Fixes for v6.9-rc3
Posted by pr-tracker-bot@kernel.org 1 year, 10 months ago
The pull request you sent on Thu, 11 Apr 2024 10:06:21 +0900:

> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git bootconfig-fixes-v6.9-rc3

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/03a55b63919f4b52b9c323d9a43ccccdc1cdb33b

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html