xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
authorHuang Zijiang <huang.zijiang@zte.com.cn>
Wed, 12 Feb 2020 09:54:36 +0000 (17:54 +0800)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 19 Feb 2020 08:33:56 +0000 (09:33 +0100)
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>
net/xfrm/xfrm_state.c

index 170d6e7f31d3a67fb91b7a65c4e54f3c1122a673..8be2d926acc21d01d7bff7cb3c295b69f5153825 100644 (file)
@@ -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);