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] [day] [month] [year] [list]
Message-Id: <1423739490-5187-2-git-send-email-martink@posteo.de>
Date:	Thu, 12 Feb 2015 12:11:30 +0100
From:	Martin Kepplinger <martink@...teo.de>
To:	linux@...ck-us.net, mingo@...nel.org, hpa@...or.com
Cc:	peterz@...radead.org, torvalds@...ux-foundation.org,
	jsrhbz@...argh.force9.co.uk,
	christoph.muellner@...obroma-systems.com, linux@...musvillemoes.dk,
	paulmck@...ux.vnet.ibm.com, tglx@...utronix.de,
	akpm@...ux-foundation.org, maxime.coquelin@...com,
	linux-kernel@...r.kernel.org, tytso@....edu,
	linux-tip-commits@...r.kernel.org,
	Martin Kepplinger <martink@...teo.de>
Subject: [RFC][PATCH] arch: sh: use sign_extend64() for sign extension

Signed-off-by: Martin Kepplinger <martink@...teo.de>
---
 arch/sh/kernel/traps_64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c
index 112ea11..4e04261 100644
--- a/arch/sh/kernel/traps_64.c
+++ b/arch/sh/kernel/traps_64.c
@@ -25,6 +25,7 @@
 #include <linux/sysctl.h>
 #include <linux/module.h>
 #include <linux/perf_event.h>
+#include <linux/bitops.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/alignment.h>
@@ -101,7 +102,7 @@ static int generate_and_check_address(struct pt_regs *regs,
 	if (displacement_not_indexed) {
 		__s64 displacement;
 		displacement = (opcode >> 10) & 0x3ff;
-		displacement = ((displacement << 54) >> 54); /* sign extend */
+		displacement = sign_extend64(displacement, 9);
 		addr = (__u64)((__s64)base_address + (displacement << width_shift));
 	} else {
 		__u64 offset;
-- 
2.1.4

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