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: <1444986427-12101-6-git-send-email-martink@posteo.de>
Date:	Fri, 16 Oct 2015 11:07:07 +0200
From:	Martin Kepplinger <martink@...teo.de>
To:	mingo@...nel.org, akpm@...ux-foundation.org, linux@...izon.com,
	linux@...musvillemoes.dk, maxime.coquelin@...com,
	dvlasenk@...hat.com, yury.norov@...il.com,
	torvalds@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org,
	Martin Kepplinger <martink@...teo.de>,
	Martin Kepplinger <martin.kepplinger@...obroma-systems.com>
Subject: [PATCH 5/5] arch: x86: use sign_extend64() for sign extension

Signed-off-by: Martin Kepplinger <martin.kepplinger@...obroma-systems.com>
---
 arch/x86/kernel/cpu/perf_event_msr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_msr.c b/arch/x86/kernel/cpu/perf_event_msr.c
index f32ac13..ec863b9 100644
--- a/arch/x86/kernel/cpu/perf_event_msr.c
+++ b/arch/x86/kernel/cpu/perf_event_msr.c
@@ -163,10 +163,9 @@ again:
 		goto again;
 
 	delta = now - prev;
-	if (unlikely(event->hw.event_base == MSR_SMI_COUNT)) {
-		delta <<= 32;
-		delta >>= 32; /* sign extend */
-	}
+	if (unlikely(event->hw.event_base == MSR_SMI_COUNT))
+		delta = sign_extend64(delta, 31);
+
 	local64_add(now - prev, &event->count);
 }
 
-- 
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