Skip to content

Commit

Permalink
init/main.c: return 1 from handled __setup() functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Randy Dunlap authored and Linus Torvalds committed Mar 24, 2022
1 parent abc7da5 commit f9a40b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,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)
Expand Down Expand Up @@ -1448,7 +1448,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
Expand Down

0 comments on commit f9a40b0

Please sign in to comment.