All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps
@ 2022-07-04 19:24 Christophe JAILLET
  2022-07-05 10:05 ` Julian Anastasov
  2022-07-20 22:58 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe JAILLET @ 2022-07-04 19:24 UTC (permalink / raw)
  To: Simon Horman, Julian Anastasov, Pablo Neira Ayuso,
	Jozsef Kadlecsik, Florian Westphal, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev,
	lvs-devel, netfilter-devel, coreteam

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 net/netfilter/ipvs/ip_vs_mh.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c
index da0280cec506..e3d7f5c879ce 100644
--- a/net/netfilter/ipvs/ip_vs_mh.c
+++ b/net/netfilter/ipvs/ip_vs_mh.c
@@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 		return 0;
 	}
 
-	table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
-			sizeof(unsigned long), GFP_KERNEL);
+	table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL);
 	if (!table)
 		return -ENOMEM;
 
@@ -227,7 +226,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
 	}
 
 out:
-	kfree(table);
+	bitmap_free(table);
 	return 0;
 }
 
-- 
2.34.1


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

* Re: [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps
  2022-07-04 19:24 [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-07-05 10:05 ` Julian Anastasov
  2022-07-16  9:12   ` Simon Horman
  2022-07-20 22:58 ` Pablo Neira Ayuso
  1 sibling, 1 reply; 4+ messages in thread
From: Julian Anastasov @ 2022-07-05 10:05 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Simon Horman, Pablo Neira Ayuso, linux-kernel, kernel-janitors,
	netdev, lvs-devel, netfilter-devel, coreteam


	Hello,

On Mon, 4 Jul 2022, Christophe JAILLET wrote:

> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

	Looks good to me for -next! Thanks!

Acked-by: Julian Anastasov <ja@ssi.bg>

> ---
>  net/netfilter/ipvs/ip_vs_mh.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c
> index da0280cec506..e3d7f5c879ce 100644
> --- a/net/netfilter/ipvs/ip_vs_mh.c
> +++ b/net/netfilter/ipvs/ip_vs_mh.c
> @@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
>  		return 0;
>  	}
>  
> -	table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE),
> -			sizeof(unsigned long), GFP_KERNEL);
> +	table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL);
>  	if (!table)
>  		return -ENOMEM;
>  
> @@ -227,7 +226,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s,
>  	}
>  
>  out:
> -	kfree(table);
> +	bitmap_free(table);
>  	return 0;
>  }
>  
> -- 
> 2.34.1

Regards

--
Julian Anastasov <ja@ssi.bg>


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

* Re: [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps
  2022-07-05 10:05 ` Julian Anastasov
@ 2022-07-16  9:12   ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2022-07-16  9:12 UTC (permalink / raw)
  To: Julian Anastasov
  Cc: Christophe JAILLET, Pablo Neira Ayuso, linux-kernel,
	kernel-janitors, netdev, lvs-devel, netfilter-devel, coreteam

On Tue, Jul 05, 2022 at 01:05:54PM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Mon, 4 Jul 2022, Christophe JAILLET wrote:
> 
> > Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> > 
> > It is less verbose and it improves the semantic.
> > 
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> 
> 	Looks good to me for -next! Thanks!
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>

Acked-by: Simon Horman <horms@verge.net.au>


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

* Re: [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps
  2022-07-04 19:24 [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps Christophe JAILLET
  2022-07-05 10:05 ` Julian Anastasov
@ 2022-07-20 22:58 ` Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2022-07-20 22:58 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Simon Horman, Julian Anastasov, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, linux-kernel, kernel-janitors, netdev, lvs-devel,
	netfilter-devel, coreteam

On Mon, Jul 04, 2022 at 09:24:46PM +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.

Applied to nf-next, thanks

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

end of thread, other threads:[~2022-07-20 22:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 19:24 [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-07-05 10:05 ` Julian Anastasov
2022-07-16  9:12   ` Simon Horman
2022-07-20 22:58 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.