linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
@ 2019-12-23  1:53 Yi Wang
  2019-12-23  9:36 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Yi Wang @ 2019-12-23  1:53 UTC (permalink / raw)
  To: steffen.klassert
  Cc: herbert, davem, netdev, linux-kernel, xue.zhihong, wang.yi59,
	up2wing, wang.liang82, Huang Zijiang

From: Huang Zijiang <huang.zijiang@zte.com.cn>

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

Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 net/xfrm/xfrm_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index a5dc319..adfa279 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
  2019-12-23  1:53 [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO Yi Wang
@ 2019-12-23  9:36 ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2019-12-23  9:36 UTC (permalink / raw)
  To: Yi Wang, steffen.klassert
  Cc: herbert, davem, netdev, linux-kernel, xue.zhihong, up2wing,
	wang.liang82, Huang Zijiang

Hello!

On 23.12.2019 4:53, Yi Wang wrote:

> From: Huang Zijiang <huang.zijiang@zte.com.cn>
> 
> Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc
> with flag GFP_ZERO since kzalloc sets allocated memory
> to zero.
> 
> Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> ---
>   net/xfrm/xfrm_state.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index a5dc319..adfa279 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -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);

    You ate the indentation. :-)

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
  2020-02-12  9:54 Yi Wang
@ 2020-02-20 12:44 ` Steffen Klassert
  0 siblings, 0 replies; 4+ messages in thread
From: Steffen Klassert @ 2020-02-20 12:44 UTC (permalink / raw)
  To: Yi Wang
  Cc: herbert, davem, kuba, netdev, linux-kernel, xue.zhihong,
	wang.liang82, Huang Zijiang

On Wed, Feb 12, 2020 at 05:54:36PM +0800, Yi Wang wrote:
> From: Huang Zijiang <huang.zijiang@zte.com.cn>
> 
> 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>

Applied to ipsec-next, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.
@ 2020-02-12  9:54 Yi Wang
  2020-02-20 12:44 ` Steffen Klassert
  0 siblings, 1 reply; 4+ messages in thread
From: Yi Wang @ 2020-02-12  9:54 UTC (permalink / raw)
  To: steffen.klassert
  Cc: herbert, davem, kuba, netdev, linux-kernel, xue.zhihong,
	wang.yi59, wang.liang82, Huang Zijiang

From: Huang Zijiang <huang.zijiang@zte.com.cn>

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>
---
 net/xfrm/xfrm_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index f342356..6ac25f7 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-20 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23  1:53 [PATCH] xfrm: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO Yi Wang
2019-12-23  9:36 ` Sergei Shtylyov
2020-02-12  9:54 Yi Wang
2020-02-20 12:44 ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).