]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[IPSEC]: kmalloc + memset conversion to kzalloc
authorJoonwoo Park <joonwpark81@gmail.com>
Mon, 26 Nov 2007 15:23:21 +0000 (23:23 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:55:05 +0000 (14:55 -0800)
2007/11/26, Patrick McHardy <kaber@trash.net>:
> How about also switching vmalloc/get_free_pages to GFP_ZERO
> and getting rid of the memset entirely while you're at it?
>

xfrm_hash: kmalloc + memset conversion to kzalloc
fix to avoid memset entirely.

Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/xfrm/xfrm_hash.c

index 55ab5792af56ecdfd2e5cafe0de0cd697246f475..a2023ec52329ef66b95e14dc94f7086e5683e534 100644 (file)
@@ -17,17 +17,14 @@ struct hlist_head *xfrm_hash_alloc(unsigned int sz)
        struct hlist_head *n;
 
        if (sz <= PAGE_SIZE)
-               n = kmalloc(sz, GFP_KERNEL);
+               n = kzalloc(sz, GFP_KERNEL);
        else if (hashdist)
-               n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL);
+               n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
        else
                n = (struct hlist_head *)
-                       __get_free_pages(GFP_KERNEL | __GFP_NOWARN,
+                       __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
                                         get_order(sz));
 
-       if (n)
-               memset(n, 0, sz);
-
        return n;
 }