stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: cpufeature: Fix truncating a feature value
@ 2019-10-10 11:08 Suzuki K Poulose
  2019-10-10 11:12 ` Suzuki K Poulose
  0 siblings, 1 reply; 9+ messages in thread
From: Suzuki K Poulose @ 2019-10-10 11:08 UTC (permalink / raw)
  To: stable
  Cc: suzuki.poulose, linux-arm-kernel, will, mark.rutland, catalin.marinas

A signed feature value is truncated to turn to an unsigned value
causing bad state in the system wide infrastructure. This affects
the discovery of FP/ASIMD support on arm64. Fix this by making sure
we cast it properly.

Fixes: 4f0a606bce5ec ("arm64: cpufeature: Track unsigned fields")
Cc: stable@vger.kernel.org # v4.4
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 arch/arm64/include/asm/cpufeature.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 0a66f8241f18..9eb0d8072dd9 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -151,8 +151,8 @@ static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp)
 static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val)
 {
 	return ftrp->sign ?
-		cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) :
-		cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width);
+		(s64)cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) :
+		(s64)cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width);
 }
 
 static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-10-11 12:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 11:08 [PATCH] arm64: cpufeature: Fix truncating a feature value Suzuki K Poulose
2019-10-10 11:12 ` Suzuki K Poulose
2019-10-10 12:29   ` Greg KH
2019-10-10 12:46     ` Suzuki K Poulose
2019-10-10 13:16       ` Greg KH
2019-10-10 13:19     ` Suzuki K Poulose
2019-10-11  4:55       ` Greg KH
2019-10-11 10:31         ` Suzuki K Poulose
2019-10-11 12:13           ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).