]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/mtrr: Use kstrtoul() in parse_mtrr_spare_reg()
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 2 Mar 2026 13:53:40 +0000 (14:53 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 2 Mar 2026 16:25:31 +0000 (17:25 +0100)
commit9a4af5a00a8bff84d8d499e43d3424173835173c
tree9ee964225ff798dc64456d26e28e5e9eee1ffc0a
parent11439c4635edd669ae435eec308f4ab8a0804808
x86/mtrr: Use kstrtoul() in parse_mtrr_spare_reg()

Replace the deprecated simple_strtoul()¹ with kstrtoul() for parsing the early
boot parameter mtrr_spare_reg_nr. simple_strtoul() silently sets
nr_mtrr_spare_reg to 0 for invalid input instead of rejecting it and keeping
the default value.

Return kstrtoul()'s retval directly to propagate parsing failures instead of
treating them as success. Also return -EINVAL when '=' is missing from the
boot parameter and 'arg' is NULL.

  ¹ https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull

  [ bp: Massage commit message. ]

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260302135341.3473-2-thorsten.blum@linux.dev
arch/x86/kernel/cpu/mtrr/cleanup.c