diff mbox series

[1/4] X86: check X86_VENDOR_ANY correctly

Message ID 1517194128-5326-1-git-send-email-rui.zhang@intel.com
State Superseded
Headers show
Series [1/4] X86: check X86_VENDOR_ANY correctly | expand

Commit Message

Zhang, Rui Jan. 29, 2018, 2:48 a.m. UTC
static const struct x86_cpu_id foo[] = {
	{ X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_ANY },
	{}
};

x86_match_cpu(foo) returns NULL with Intel processors.

This is wrong because,
unlike X86_FAMILY_ANY/X86_MODEL_ANY/X86_FEATURE_ANY, X86_VENDOR_ANY is
0xffff, rather than 0.

Fix x86_match_cpu() by checking X86_VENDOR_ANY explicitly.

cc: x86@kernel.org
cc: tglx@linutronix.de
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 arch/x86/kernel/cpu/match.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
index 3fed388..72f363e 100644
--- a/arch/x86/kernel/cpu/match.c
+++ b/arch/x86/kernel/cpu/match.c
@@ -34,7 +34,7 @@  const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match)
 	const struct x86_cpu_id *m;
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
-	for (m = match; m->vendor | m->family | m->model | m->feature; m++) {
+	for (m = match; (m->vendor != X86_VENDOR_ANY) | m->family | m->model | m->feature; m++) {
 		if (m->vendor != X86_VENDOR_ANY && c->x86_vendor != m->vendor)
 			continue;
 		if (m->family != X86_FAMILY_ANY && c->x86 != m->family)