Skip to content

Commit

Permalink
xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag…
Browse files Browse the repository at this point in the history
… GFP_ZERO.

Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc
with flag GFP_ZERO since kzalloc sets allocated memory
to zero.

Change in v2:
     add indation

Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Huang Zijiang authored and Steffen Klassert committed Feb 19, 2020
1 parent 92df9f8 commit a4c278d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ struct xfrm_state *xfrm_state_alloc(struct net *net)
{
struct xfrm_state *x;

x = kmem_cache_alloc(xfrm_state_cache, GFP_ATOMIC | __GFP_ZERO);
x = kmem_cache_zalloc(xfrm_state_cache, GFP_ATOMIC);

if (x) {
write_pnet(&x->xs_net, net);
Expand Down

0 comments on commit a4c278d

Please sign in to comment.