Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp477666imw; Mon, 4 Jul 2022 13:06:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tvxse1phixfLicUqNvTNkWYWcuES4J8p66GVqbvyYNzg6txHRTwur+cNw9Y2s+6BovWZdd X-Received: by 2002:a17:903:245:b0:16b:9c49:6b1c with SMTP id j5-20020a170903024500b0016b9c496b1cmr31811396plh.153.1656965193946; Mon, 04 Jul 2022 13:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656965193; cv=none; d=google.com; s=arc-20160816; b=cYJ/GxChGkmfuS1gxXSTO+qr1SHPu5ADw+3PPNF8pvfWoSvst2gYNLqa9c5y1DiuY7 2LjOQ/H5Hh6S9SNl4g60bflwwVTKg2mIyh/917mM2TBfQSfDcnlCE0w92/ClikuX1m+p IjuP8gtET1/vhMbLGTfqD9GRzk1dMw9mxAjpj4WfDh3uuAlxNhvQtUgIEliZc7xFPMrg EYuI1t23X1F6ASaugTpP25Jb0+/zbCaVPHzNBZosFX+A+opzxBC4E7bTIdDqcQ5ubX7J gbOha9CtAos1Fk5X40J3m2Hu14MVzshKUot+Fi52pRNNo9nb+ezfppoHIKN1Q5mGxNiy oosQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=9zKqB6CNq+E30t+AocfMjB9JErZK7BCyK+Ue/G97u64=; b=pn58S+x9cRYk/PEzFQYqRu6NGLhCJP0eV7beObIFO/hZbNwLsl+tpOai2Rxx0XpCcx PGQdCSalLOArLad6G9v31y+zdUamzVRUpXq20msk0r6VLpllQ+SCFvgRPabJFrbPzljp /toVva2Vn8Pp2IBO304ZTD9f5nWC/6+ra/8gHCMX7twqRnBVNCY1Ml5mezilsrbUryyw rykOxxquWD9jTsnpvrXfBmzVYVQgc7AqVG3ztPu4+7lpSN1oQCmsallgCxgJ5FXopjQR T7H1HdmFME5N4adlG5npz9FEZ9GPyLBeFhQBCv8Okbe+XgIJigzapnkIOCn/KrlZy2XW qFiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l70-20020a638849000000b0040d37aa9ae1si9830544pgd.587.2022.07.04.13.06.18; Mon, 04 Jul 2022 13:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234456AbiGDTY5 (ORCPT + 99 others); Mon, 4 Jul 2022 15:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231365AbiGDTYz (ORCPT ); Mon, 4 Jul 2022 15:24:55 -0400 Received: from smtp.smtpout.orange.fr (smtp09.smtpout.orange.fr [80.12.242.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8575BCE14 for ; Mon, 4 Jul 2022 12:24:53 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id 8RgdopqG9OXCy8Rgeoi3li; Mon, 04 Jul 2022 21:24:51 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Mon, 04 Jul 2022 21:24:51 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Simon Horman , Julian Anastasov , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org Subject: [PATCH] netfilter: ipvs: Use the bitmap API to allocate bitmaps Date: Mon, 4 Jul 2022 21:24:46 +0200 Message-Id: <420d8b70560e8711726ff639f0a55364e212ff26.1656962678.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use bitmap_zalloc()/bitmap_free() instead of hand-writing them. It is less verbose and it improves the semantic. Signed-off-by: Christophe JAILLET --- 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