[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190328154948.152273-1-jannh@google.com>
Date: Thu, 28 Mar 2019 16:49:48 +0100
From: Jann Horn <jannh@...gle.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, jannh@...gle.com
Cc: x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/cpufeature: fix __percpu annotation in this_cpu_has()
&cpu_info.x86_capability is __percpu, and the second argument of
x86_this_cpu_test_bit() is expected to be __percpu. Don't cast the __percpu
away and then implicitly add it again.
This gets rid of 106 lines of sparse warnings with the kernel config I'm
using.
Signed-off-by: Jann Horn <jannh@...gle.com>
---
arch/x86/include/asm/cpufeature.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index ce95b8cbd229..0df88893e767 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -113,7 +113,8 @@ extern const char * const x86_bug_flags[NBUGINTS*32];
#define this_cpu_has(bit) \
(__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \
- x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability))
+ x86_this_cpu_test_bit(bit, \
+ (unsigned long __percpu *)&cpu_info.x86_capability))
/*
* This macro is for detection of features which need kernel
--
2.21.0.392.gf8f6787159e-goog
Powered by blists - more mailing lists