* [PATCH] x86/boot: Replace simple_strtoull in parse_gb_huge_pages
@ 2026-01-12 17:26 Thorsten Blum
0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-01-12 17:26 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Andrew Morton, Mike Rapoport (Microsoft),
Alexander Graf, Changyuan Lyu
Cc: Thorsten Blum, linux-kernel
Replace simple_strtoull() with the recommended boot_kstrtoul() for
parsing the 'hugepages=' boot parameter. Unlike simple_strtoull(), which
returns an unsigned long long, boot_kstrtoul() converts the string
directly to an unsigned long and avoids implicit casting.
Check the return value of boot_kstrtoul() and warn about invalid values.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/x86/boot/compressed/kaslr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 3b0948ad449f..e6c44a0d3640 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -219,7 +219,8 @@ static void parse_gb_huge_pages(char *param, char *val)
if (!strcmp(param, "hugepages") && gbpage_sz) {
p = val;
- max_gb_huge_pages = simple_strtoull(p, &p, 0);
+ if (boot_kstrtoul(p, 0, &max_gb_huge_pages))
+ warn("Failed to parse boot parameter hugepages\n");
return;
}
}
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-01-12 17:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-12 17:26 [PATCH] x86/boot: Replace simple_strtoull in parse_gb_huge_pages Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®