[PATCH 2/8] x86/microcode: Solidify base_rev= option parsing
From: Chang S. Bae
Date: Tue Sep 01 2026 - 19:44:09 EST
After base_rev= has been parsed, the remainder of the token is still
compared against the other option names. Along with this, the substring
check strstr() may also produce a spurious match.
Move on to the next token once the option has been parsed, and use
str_has_prefix() instead.
Fixes: 43181a47263d ("x86/microcode: Add microcode loader debugging functionality")
Signed-off-by: Chang S. Bae <chang.seok.bae@xxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/microcode/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index 0dd0c7241c57..303b0d0b4573 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -146,10 +146,11 @@ static void __init early_parse_cmdline(void)
if (cmdline_find_option(boot_command_line, "microcode", cmd_buf, sizeof(cmd_buf)) > 0) {
while ((s = strsep(&p, ","))) {
if (IS_ENABLED(CONFIG_MICROCODE_DBG)) {
- if (strstr(s, "base_rev=")) {
+ if (str_has_prefix(s, "base_rev=")) {
/* advance to the option arg */
strsep(&s, "=");
if (kstrtouint(s, 16, &base_rev)) { ; }
+ continue;
}
}
--
2.53.0