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: <20160905075409.GT10153@twins.programming.kicks-ass.net>
Date:   Mon, 5 Sep 2016 01:54:09 -0600
From:   Peter Zijlstra <peterz@...radead.org>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>
CC:     <x86@...nel.org>, Borislav Petkov <bp@...e.de>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
        Richard Cochran <rcochran@...utronix.de>,
        Stephane Eranian <eranian@...gle.com>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        "Luck, Tony" <tony.luck@...el.com>,
        "Vikas Shivappa" <vikas.shivappa@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        <kernel-janitors@...r.kernel.org>,
        "Julia Lawall" <julia.lawall@...6.fr>,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH 3/4] perf/x86/cqm: One check and another variable less in intel_mbm_init()

On Sun, Sep 04, 2016 at 07:58:32PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Sun, 4 Sep 2016 19:06:33 +0200
> 
> 1. Adjust a jump target to eliminate an extra check at the end.
> 
> 2. Move a jump label according to the current Linux coding style convention.

WTF does that even mean?

> 
> 3. Return only constant values for the success or failure indication.
> 
> 4. Delete the local variable "ret" which became unnecessary with
>    this refactoring.

Also, 4 things should be 4 patches if anything.

> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  arch/x86/events/intel/cqm.c | 25 ++++++++++---------------
>  1 file changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/x86/events/intel/cqm.c b/arch/x86/events/intel/cqm.c
> index 29f756e..304caf53 100644
> --- a/arch/x86/events/intel/cqm.c
> +++ b/arch/x86/events/intel/cqm.c
> @@ -1637,7 +1637,7 @@ static const struct x86_cpu_id intel_mbm_total_match[] = {
>  
>  static int intel_mbm_init(void)
>  {
> -	int ret = 0, maxid = cqm_max_rmid + 1;
> +	int const maxid = cqm_max_rmid + 1;
>  
>  	mbm_socket_max = topology_max_packages();
>  	mbm_local = kmalloc_array(maxid * mbm_socket_max,
> @@ -1649,25 +1649,20 @@ static int intel_mbm_init(void)
>  	mbm_total = kmalloc_array(maxid * mbm_socket_max,
>  				  sizeof(*mbm_total),
>  				  GFP_KERNEL);
> -	if (!mbm_total) {
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> +	if (!mbm_total)
> +		goto free_mbm;
>  
>  	mbm_timers = kmalloc_array(mbm_socket_max,
>  				   sizeof(*mbm_timers),
>  				   GFP_KERNEL);
> -	if (!mbm_timers) {
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> -	mbm_hrtimer_init();
> +	if (!mbm_timers)
> +		goto free_mbm;
>  
> -out:
> -	if (ret)
> -		mbm_cleanup();
> -
> -	return ret;
> +	mbm_hrtimer_init();
> +	return 0;
> + free_mbm:

No!! no stupid indented labels.

> +	mbm_cleanup();
> +	return -ENOMEM;
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ