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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180628084002.GZ2494@hirez.programming.kicks-ass.net>
Date:   Thu, 28 Jun 2018 10:40:02 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        g@...ez.programming.kicks-ass.net
Cc:     linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        x86@...nel.org, Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will.deacon@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 1/5] kernel/jump_label: abstract jump_entry member
 accessors

On Wed, Jun 27, 2018 at 06:06:00PM +0200, Ard Biesheuvel wrote:

> diff --git a/kernel/jump_label.c b/kernel/jump_label.c
> index 01ebdf1f9f40..c3524c9b3004 100644
> --- a/kernel/jump_label.c
> +++ b/kernel/jump_label.c
> @@ -38,10 +38,12 @@ static int jump_label_cmp(const void *a, const void *b)
>  	const struct jump_entry *jea = a;
>  	const struct jump_entry *jeb = b;
>  
> -	if (jea->key < jeb->key)
> +	if ((unsigned long)jump_entry_key(jea) <
> +	    (unsigned long)jump_entry_key(jeb))
>  		return -1;
>  
> -	if (jea->key > jeb->key)
> +	if ((unsigned long)jump_entry_key(jea) >
> +	    (unsigned long)jump_entry_key(jeb))
>  		return 1;

I think you can ditch the unsigned long cast and directly compare
pointers. That leads to much prettier code:

	if (jump_entry_key(jea) < jump_entry_key(jeb))
		return -1;

etc..

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ