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:	Wed, 12 May 2010 09:29:10 +0200
From:	walter harms <wharms@....de>
To:	Julia Lawall <julia@...u.dk>
CC:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	", H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 5/5] arch/x86/kernel: Drop memory allocation cast



Julia Lawall schrieb:
> From: Julia Lawall <julia@...u.dk>
> 
> Drop cast on the result of kmalloc and similar functions.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> type T;
> @@
> 
> - (T *)
>   (\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
>    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...))
> // </smpl>
> 
> Signed-off-by: Julia Lawall <julia@...u.dk>
> 
> ---
>  arch/x86/kernel/tlb_uv.c            |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
> index 7fea555..9064179 100644
> --- a/arch/x86/kernel/tlb_uv.c
> +++ b/arch/x86/kernel/tlb_uv.c
> @@ -1141,7 +1141,7 @@ uv_activation_descriptor_init(int node, int pnode)
>  	 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
>  	 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
>  	 */
> -	bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
> +	bau_desc = kmalloc_node(sizeof(struct bau_desc) *
>  		UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
>  	BUG_ON(!bau_desc);
>  
> @@ -1200,7 +1200,7 @@ uv_payload_queue_init(int node, int pnode)
>  	struct bau_payload_queue_entry *pqp_malloc;
>  	struct bau_control *bcp;
>  
> -	pqp = (struct bau_payload_queue_entry *) kmalloc_node(
> +	pqp = kmalloc_node(
>  		(DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry),
>  		GFP_KERNEL, node);
>  	BUG_ON(!pqp);
> @@ -1286,8 +1286,7 @@ static void uv_init_per_cpu(int nuvhubs)
>  	};
>  	struct uvhub_desc *uvhub_descs;
>  
> -	uvhub_descs = (struct uvhub_desc *)
> -		kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
> +	uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
>  	memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
>  	for_each_present_cpu(cpu) {
>  		bcp = &per_cpu(bau_control, cpu);

kzmalloc() ?

BUG_ON(!uvhub_descs); ?

re,
 wh
--
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