From e39fcef01c68d086892d72c0ffdeaf913144bd37 Mon Sep 17 00:00:00 2001 From: Jacky Liu Date: Tue, 26 Nov 2024 13:03:39 +0800 Subject: [PATCH] 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 --- mm/page_size_compat.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/page_size_compat.c b/mm/page_size_compat.c index 19cd902aed87..c912ad12ee35 100644 --- a/mm/page_size_compat.c +++ b/mm/page_size_compat.c @@ -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;