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]
Date:   Mon, 5 Sep 2016 11:26:15 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     SF Markus Elfring <elfring@...rs.sourceforge.net>, x86@...nel.org,
        Andi Kleen <ak@...ux.intel.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Borislav Petkov <bp@...e.de>, "H. Peter Anvin" <hpa@...or.com>,
        Ingo Molnar <mingo@...hat.com>, Jiri Olsa <jolsa@...hat.com>,
        Jürgen Groß <jgross@...e.com>,
        Len Brown <len.brown@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 3/4] x86/smpboot: Replace one kzalloc() call by kcalloc()



On 05/09/2016 10:12, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 5 Sep 2016 09:29:40 +0200
> 
> * The script "checkpatch.pl" can point information out like the following.
> 
>   WARNING: Prefer kcalloc over kzalloc with multiply
> 
>   Thus fix the affected source code place.
> 
> * Replace the specification of a data type by a pointer dereference
>   to make the corresponding size determination a bit safer according to
>   the Linux coding style convention.
> 
> * Delete the local variable "size" which became unnecessary with
>   this refactoring.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  arch/x86/kernel/smpboot.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 2ce06ef..e3fdc44 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -311,7 +311,6 @@ EXPORT_SYMBOL(topology_phys_to_logical_pkg);
>  static void __init smp_init_package_map(void)
>  {
>  	unsigned int ncpus, cpu;
> -	size_t size;
>  
>  	/*
>  	 * Today neither Intel nor AMD support heterogenous systems. That
> @@ -357,8 +356,9 @@ static void __init smp_init_package_map(void)
>  	memset(physical_to_logical_pkg,
>  	       0xff,
>  	       sizeof(*physical_to_logical_pkg) * max_physical_pkg_id);
> -	size = BITS_TO_LONGS(max_physical_pkg_id) * sizeof(unsigned long);
> -	physical_package_map = kzalloc(size, GFP_KERNEL);
> +	physical_package_map = kcalloc(BITS_TO_LONGS(max_physical_pkg_id),
> +				       sizeof(*physical_package_map),
> +				       GFP_KERNEL);

This is bitmap_alloc.

Paolo

>  	for_each_present_cpu(cpu) {
>  		unsigned int apicid = apic->cpu_present_to_apicid(cpu);
> 

Powered by blists - more mailing lists