Skip to contentSkip to conversation

x86: apic: Fix parsing of lapic cmdline option

PATCH In review Mathias Krause 3 participants 3 messages Feb 19, 2013 – Feb 20, 2013 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: apic: Fix parsing of lapic cmdline option

Including " lapic " in the kernel cmdline on an x86-64 kernel makes it panic while parsing early params -- e.g. with no user visible output.

Fix this bug by ensuring arg is non-NULL before passing it to strncmp().

---
 arch/x86/kernel/apic/apic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +1 -1
index b994cc8..cbf5121 100644
@@ -131,7 +131,7 @@ static int __init parse_lapic(char *arg)
 {
 	if (config_enabled(CONFIG_X86_32) && !arg)
 		force_enable_local_apic = 1;
-	else if (!strncmp(arg, "notscdeadline", 13))
+	else if (arg && !strncmp(arg, "notscdeadline", 13))
 		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
 	return 0;
 }
Signature · 1 line
1.7.10.4
#2 lore raw

[tip:x86/urgent] x86/apic: Fix parsing of the 'lapic' cmdline option

In reply to Mathias Krause
x86/apic: Fix parsing of the 'lapic' cmdline option
Commit-ID:  27cf929845b10043f2257693c7d179a9e0b1980e
Gitweb:     http://git.kernel.org/tip/27cf929845b10043f2257693c7d179a9e0b1980e
Author:     Mathias Krause <[email protected]>
AuthorDate: Tue, 19 Feb 2013 20:47:07 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 20 Feb 2013 11:24:36 +0100

x86/apic: Fix parsing of the 'lapic' cmdline option

Including " lapic " in the kernel cmdline on an x86-64 kernel makes it panic while parsing early params -- e.g. with no user visible output.

Fix this bug by ensuring arg is non-NULL before passing it to strncmp().

---
 arch/x86/kernel/apic/apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apic/apic.c +1 -1
index a5b4dce..904611b 100644
@@ -131,7 +131,7 @@ static int __init parse_lapic(char *arg)
 {
 	if (config_enabled(CONFIG_X86_32) && !arg)
 		force_enable_local_apic = 1;
-	else if (!strncmp(arg, "notscdeadline", 13))
+	else if (arg && !strncmp(arg, "notscdeadline", 13))
 		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
 	return 0;
 }