Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: ipvs: Use the bitmap API to allocate bitmaps

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>

authored by

Christophe JAILLET and committed by
Pablo Neira Ayuso
5787db7c 9d2f00fb

+2 -3
+2 -3
net/netfilter/ipvs/ip_vs_mh.c
··· 174 174 return 0; 175 175 } 176 176 177 - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), 178 - sizeof(unsigned long), GFP_KERNEL); 177 + table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL); 179 178 if (!table) 180 179 return -ENOMEM; 181 180 ··· 226 227 } 227 228 228 229 out: 229 - kfree(table); 230 + bitmap_free(table); 230 231 return 0; 231 232 } 232 233