ANDROID: 16K: Duplicate command line for parsing page_shift

Using parse_args() on saved_command_line modifies it and results in
losing the original content. Duplicate the command line for parsing.

Fixes: ad60adea543b ("ANDROID: 16K: Init page_shift param in a pure_initcall()")
Bug: 380987371
Change-Id: I6998e465bbedc03c2e319bb27fb13b7dad666042
Signed-off-by: Jacky Liu <qsliu@google.com>
This commit is contained in:
Jacky Liu
2024-11-26 13:03:39 +08:00
committed by Carlos Llamas
parent 44a6882cc7
commit e39fcef01c

View File

@@ -54,10 +54,17 @@ static int __init page_shift_params(char *param, char *val,
static int __init init_page_shift_compat(void)
{
char *err;
char *command_line;
err = parse_args("page_shift", saved_command_line, NULL, 0, 0, 0, NULL,
command_line = kstrdup(saved_command_line, GFP_KERNEL);
if (!command_line)
return -ENOMEM;
err = parse_args("page_shift", command_line, NULL, 0, 0, 0, NULL,
page_shift_params);
kfree(command_line);
if (IS_ERR(err))
return -EINVAL;