lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-a3d2d12f275fcd33d7edc34e6b4112b5a3c9d35d@git.kernel.org>
Date:	Tue, 29 Jun 2010 07:07:04 GMT
From:	"tip-bot for H. Peter Anvin" <hpa@...ux.intel.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
	tglx@...utronix.de, laijs@...fujitsu.com, hpa@...ux.intel.com
Subject: [tip:x86/alternatives] x86, alternatives: correct obsolete use of "u8" in static_cpu_has()

Commit-ID:  a3d2d12f275fcd33d7edc34e6b4112b5a3c9d35d
Gitweb:     http://git.kernel.org/tip/a3d2d12f275fcd33d7edc34e6b4112b5a3c9d35d
Author:     H. Peter Anvin <hpa@...ux.intel.com>
AuthorDate: Mon, 28 Jun 2010 12:00:18 -0700
Committer:  H. Peter Anvin <hpa@...or.com>
CommitDate: Mon, 28 Jun 2010 22:04:47 -0700

x86, alternatives: correct obsolete use of "u8" in static_cpu_has()

gcc seems to pass unsigned words on as signed to the assembler, at
least with the %P format.  As such, it is critical to get the correct
type.

Furthermore we are no longer limited to features < 256.

Reported-and-tested-by: Lai Jiangshan <laijs@...fujitsu.com>
LKML-Reference: <4C2474EF.4050902@...fujitsu.com>
Signed-off-by: H. Peter Anvin <hpa@...ux.intel.com>
---
 arch/x86/include/asm/cpufeature.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 66878c5..e8b8896 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -291,7 +291,7 @@ extern const char * const x86_power_flags[32];
  * patch the target code for additional performance.
  *
  */
-static __always_inline __pure bool __static_cpu_has(u8 bit)
+static __always_inline __pure bool __static_cpu_has(u16 bit)
 {
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 		asm goto("1: jmp %l[t_no]\n"
@@ -339,7 +339,7 @@ static __always_inline __pure bool __static_cpu_has(u8 bit)
 (								\
 	__builtin_constant_p(boot_cpu_has(bit)) ?		\
 		boot_cpu_has(bit) :				\
-	(__builtin_constant_p(bit) && !((bit) & ~0xff)) ?	\
+	__builtin_constant_p(bit) ?				\
 		__static_cpu_has(bit) :				\
 		boot_cpu_has(bit)				\
 )
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ