summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandy Dunlap <rdunlap@infradead.org>2022-03-23 16:06:14 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:15:03 +0200
commitc616808669f9f6e8f9f28f2f38ddb5f322160b94 (patch)
tree9b419de788ae7d11ae63a8142923ac215a104821
parent684e505406abaeabe0058e9776f9210bf2747953 (diff)
downloadlinux-stable-c616808669f9f6e8f9f28f2f38ddb5f322160b94.tar.gz
linux-stable-c616808669f9f6e8f9f28f2f38ddb5f322160b94.tar.bz2
linux-stable-c616808669f9f6e8f9f28f2f38ddb5f322160b94.zip
init/main.c: return 1 from handled __setup() functions
[ Upstream commit f9a40b0890658330c83c95511f9d6b396610defc ] initcall_blacklist() should return 1 to indicate that it handled its cmdline arguments. set_debug_rodata() should return 1 to indicate that it handled its cmdline arguments. Print a warning if the option string is invalid. This prevents these strings from being added to the 'init' program's environment as they are not init arguments/parameters. Link: https://lkml.kernel.org/r/20220221050901.23985-1-rdunlap@infradead.org Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru> Cc: Ingo Molnar <mingo@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--init/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/init/main.c b/init/main.c
index 7baad67c2e93..272ec131211c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -774,7 +774,7 @@ static int __init initcall_blacklist(char *str)
}
} while (str_entry);
- return 0;
+ return 1;
}
static bool __init_or_module initcall_blacklisted(initcall_t fn)
@@ -1027,7 +1027,9 @@ static noinline void __init kernel_init_freeable(void);
bool rodata_enabled __ro_after_init = true;
static int __init set_debug_rodata(char *str)
{
- return strtobool(str, &rodata_enabled);
+ if (strtobool(str, &rodata_enabled))
+ pr_warn("Invalid option string for rodata: '%s'\n", str);
+ return 1;
}
__setup("rodata=", set_debug_rodata);
#endif