All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Rui <rui.zhang@intel.com>
To: alexandre.belloni@free-electrons.com, linux-rtc@vger.kernel.org
Cc: gabriele.mzt@gmail.com, rui.zhang@intel.com, x86@kernel.org,
	tglx@linutronix.de
Subject: [PATCH 1/4] X86: check X86_VENDOR_ANY correctly
Date: Mon, 29 Jan 2018 10:48:45 +0800	[thread overview]
Message-ID: <1517194128-5326-1-git-send-email-rui.zhang@intel.com> (raw)

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 --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)
-- 
2.7.4

             reply	other threads:[~2018-01-29  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29  2:48 Zhang Rui [this message]
2018-01-29  2:48 ` [PATCH 2/4] rtc: cmos: allow using ACPI for RTC alarm instead of HPET Zhang Rui
2018-01-29  2:48 ` [PATCH 3/4] rtc: cmos: acknowledge ACPI driven wake alarms upon resume Zhang Rui
2018-01-29  2:48 ` [PATCH 4/4] rtc: cmos: introduce quirks to enable use_acpi_alarm mode Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517194128-5326-1-git-send-email-rui.zhang@intel.com \
    --to=rui.zhang@intel.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=gabriele.mzt@gmail.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.