netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com
Subject: [PATCH nf-next 16/18] netfilter: ipvs: Use the bitmap API to allocate bitmaps
Date: Thu, 21 Jul 2022 01:07:52 +0200	[thread overview]
Message-ID: <20220720230754.209053-17-pablo@netfilter.org> (raw)
In-Reply-To: <20220720230754.209053-1-pablo@netfilter.org>

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

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>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 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.30.2


  parent reply	other threads:[~2022-07-20 23:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 23:07 [PATCH nf-next 00/18] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 01/18] netfilter: conntrack: use fallthrough to cleanup Pablo Neira Ayuso
2022-07-21  4:10   ` patchwork-bot+netdevbpf
2022-07-20 23:07 ` [PATCH nf-next 02/18] netfilter: conntrack: use correct format characters Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 03/18] net/sched: act_ct: set 'net' pointer when creating new nf_flow_table Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 04/18] netfilter: nf_flow_table: count pending offload workqueue tasks Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 05/18] netfilter: nf_conntrack: add missing __rcu annotations Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 06/18] netfilter: nf_conntrack: use rcu accessors where needed Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 07/18] netfilter: h323: merge nat hook pointers into one Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 08/18] netfilter: nft_set_bitmap: Fix spelling mistake Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 09/18] netfilter: nfnetlink: add missing __be16 cast Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 10/18] netfilter: x_tables: use correct integer types Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 11/18] netfilter: nf_tables: use the correct get/put helpers Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 12/18] netfilter: nf_tables: add and use BE register load-store helpers Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 13/18] netfilter: nf_tables: use correct integer types Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 14/18] netfilter: nf_tables: move nft_cmp_fast_mask to where its used Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 15/18] netfilter: nf_nat: in nf_nat_initialized(), use const struct nf_conn * Pablo Neira Ayuso
2022-07-20 23:07 ` Pablo Neira Ayuso [this message]
2022-07-20 23:07 ` [PATCH nf-next 17/18] netfilter: flowtable: prefer refcount_inc Pablo Neira Ayuso
2022-07-20 23:07 ` [PATCH nf-next 18/18] netfilter: xt_TPROXY: remove pr_debug invocations Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220720230754.209053-17-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).