lkml.org 
[lkml]   [2007]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] xfrm_hash: kmalloc + memset conversion to kzalloc
Joonwoo Park wrote:
> diff --git a/net/xfrm/xfrm_hash.c b/net/xfrm/xfrm_hash.c
> index 55ab579..37795bd 100644
> --- a/net/xfrm/xfrm_hash.c
> +++ b/net/xfrm/xfrm_hash.c
> @@ -17,16 +17,17 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
> struct hlist_head *n;
>
> if (sz <= PAGE_SIZE)
> - n = kmalloc(sz, GFP_KERNEL);
> - else if (hashdist)
> - n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL);
> - else
> - n = (struct hlist_head *)
> - __get_free_pages(GFP_KERNEL | __GFP_NOWARN,
> - get_order(sz));
> -
> - if (n)
> - memset(n, 0, sz);
> + n = kzalloc(sz, GFP_KERNEL);
> + else {
> + if (hashdist)
> + n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL);
> + else
> + n = (struct hlist_head *)
> + __get_free_pages(GFP_KERNEL | __GFP_NOWARN,
> + get_order(sz));
> + if (n)
> + memset(n, 0, sz);


How about also switching vmalloc/get_free_pages to GFP_ZERO
and getting rid of the memset entirely while you're at it?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-26 10:15    [W:0.045 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site