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: <20151016213026.22362.qmail@ns.horizon.com>
Date:	16 Oct 2015 17:30:26 -0400
From:	"George Spelvin" <linux@...izon.com>
To:	akpm@...ux-foundation.org, dvlasenk@...hat.com, linux@...izon.com,
	linux@...musvillemoes.dk, martink@...teo.de,
	maxime.coquelin@...com, mingo@...nel.org,
	torvalds@...ux-foundation.org, yury.norov@...il.com
Cc:	linux-kernel@...r.kernel.org,
	martin.kepplinger@...obroma-systems.com
Subject: Re: [PATCH 5/5] arch: x86: use sign_extend64() for sign extension

> --- 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);
>  }

GCC can figure it out wither way, but wouldn't

	delta = (s32)delta;

be simpler than either?
--
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