Commit dcaee95a1b396f85cdc28099f39710be328d3a5e

Authored by Joonwoo Park
Committed by David S. Miller
1 parent 8512430e55

[IPSEC]: kmalloc + memset conversion to kzalloc

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>

Showing 1 changed file with 3 additions and 6 deletions Side-by-side Diff

net/xfrm/xfrm_hash.c
... ... @@ -17,16 +17,13 @@
17 17 struct hlist_head *n;
18 18  
19 19 if (sz <= PAGE_SIZE)
20   - n = kmalloc(sz, GFP_KERNEL);
  20 + n = kzalloc(sz, GFP_KERNEL);
21 21 else if (hashdist)
22   - n = __vmalloc(sz, GFP_KERNEL, PAGE_KERNEL);
  22 + n = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL);
23 23 else
24 24 n = (struct hlist_head *)
25   - __get_free_pages(GFP_KERNEL | __GFP_NOWARN,
  25 + __get_free_pages(GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO,
26 26 get_order(sz));
27   -
28   - if (n)
29   - memset(n, 0, sz);
30 27  
31 28 return n;
32 29 }