diff options
| author | Jann Horn <jannh@google.com> | 2019-03-28 11:49:48 -0400 |
|---|---|---|
| committer | Borislav Petkov <bp@suse.de> | 2019-03-28 12:03:11 -0400 |
| commit | f6027c81099e87516d27d123867f10abd04b2d38 (patch) | |
| tree | d354e092a893b6d9fa99e02b5dd80f8601df8a68 | |
| parent | 92c77f7c4d5dfaaf45b2ce19360e69977c264766 (diff) | |
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@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190328154948.152273-1-jannh@google.com
| -rw-r--r-- | arch/x86/include/asm/cpufeature.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index ce95b8cbd229..0e56ff7e4848 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
| @@ -112,8 +112,9 @@ extern const char * const x86_bug_flags[NBUGINTS*32]; | |||
| 112 | test_cpu_cap(c, bit)) | 112 | test_cpu_cap(c, bit)) |
| 113 | 113 | ||
| 114 | #define this_cpu_has(bit) \ | 114 | #define this_cpu_has(bit) \ |
| 115 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ | 115 | (__builtin_constant_p(bit) && REQUIRED_MASK_BIT_SET(bit) ? 1 : \ |
| 116 | x86_this_cpu_test_bit(bit, (unsigned long *)&cpu_info.x86_capability)) | 116 | x86_this_cpu_test_bit(bit, \ |
| 117 | (unsigned long __percpu *)&cpu_info.x86_capability)) | ||
| 117 | 118 | ||
| 118 | /* | 119 | /* |
| 119 | * This macro is for detection of features which need kernel | 120 | * This macro is for detection of features which need kernel |
