Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5367258rwl; Tue, 11 Apr 2023 04:36:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Z/D2+TYxWRx2gVLa690tuIt+d8aHZfMCDQzik7IndJkhEDN4fEQxyhtleG9JDMgRat5wFv X-Received: by 2002:a17:903:2302:b0:1a1:d774:a3d7 with SMTP id d2-20020a170903230200b001a1d774a3d7mr23841479plh.25.1681212992499; Tue, 11 Apr 2023 04:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681212992; cv=none; d=google.com; s=arc-20160816; b=r/QQz+oraflVVDlROaNT68YgwzNFH9WCtKTNqD1c8vpvuMT7ZNmh5oXHMJLrTebnlR OR18n/uSM8447uRWzPdjNnC5BZBXM1wEermnnFQZ7pZRcrwOGLzE5S8WJSpAz7sgdNnN nyoceqsflTt8tlGUsze/AJNKmCxh8N0kd4ukd8G6cwOVGxfUg+b2rGqgmbAYXGggx/ac 4ffjXSFSqxgr8HPCD6i3RUaCH9soiLFkZzN5XwlsUfswa1F80QO8cybyLdQRWmf0Yipf QgqWfGkb3ltZvLPTRvDJNmssuvS3n2Z9l50yCIAPW3s6383jo8vtbP68GlfJjQBh4we4 BH0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/mQiYyPDObST5mhaz9jKgCGraKWDmlyUSFnKU5Na8vs=; b=djt6s0BdPyUXXVqLq7ombtXaYL6OkW4jsjqLs2SykJ364/iQi9FTrtNMgKigjZ0gbV 3TbpjiZEGiPeLcmTgcRRe15vobeXsmI3G5KRytTmPCOQBKsKthKcXHT+3D3TKs6dmJwG dgblF2h81eCIdc3Ir7D0FQJ0fZ70kASbHrQQQtXktRnO86idLOLXR3qvoQP56mT6THcF vtehuUD13B//tDpDPKEPJxlclv1/9tCoyrO0v1MiaGBk1gAv8uXJXAOJIh5ZkgecSvmy 0kZGer7ZhcQ/nlK09DpdbzEwJkDBDMCplH6canS6cU8/mGHWT1DWaAeFDyoe6hELnFQc 0ASw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=fhAKYZ41; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a6546c3000000b004fc2f19bacasi13076932pgr.120.2023.04.11.04.36.19; Tue, 11 Apr 2023 04:36:32 -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; dkim=pass header.i=@microchip.com header.s=mchp header.b=fhAKYZ41; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbjDKLfC (ORCPT + 99 others); Tue, 11 Apr 2023 07:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjDKLfB (ORCPT ); Tue, 11 Apr 2023 07:35:01 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925B4E60; Tue, 11 Apr 2023 04:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1681212901; x=1712748901; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=rCpRx8zrwmywWfUW2YxiAvJ2J1O/eklkQmlDcOmjNXM=; b=fhAKYZ41cHJHfbwdsQOuVm7zIQzmM1Y7NfILam97srLnMnG72a/IPMyU MUOpFIDgdIKKA8C5LdKLc5Ioz366hcEP0y4fCWCEnEd19VKwVPUQf3dtq 1Gs933GhUxvw0vargbJM0E8xIeReVkfw3XkqxW/XcSVNBa2F9e7l28xUf GlZxFmxv+JRIe4jKjtMkA9jGPAnZ2dFnxvFDb9H0xfbEWMSXFfHsmgEv/ UtKsHU/VGNa8BGi7UCVfTzbYWuLT04FtyBfAACya6KPbcwOfABlqSuJhN PDRTI78UeJKJIpwDGfGIIEGz/qGu4OLEZ0pZKFK+06yAEP5iZHZ9ysP8q w==; X-IronPort-AV: E=Sophos;i="5.98,336,1673938800"; d="scan'208";a="209023260" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Apr 2023 04:34:55 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Tue, 11 Apr 2023 04:34:51 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Tue, 11 Apr 2023 04:34:50 -0700 Date: Tue, 11 Apr 2023 13:34:50 +0200 From: Horatiu Vultur To: Simon Horman CC: Julian Anastasov , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , , "David S. Miller" , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , , Subject: Re: [PATCH nf-next v2 2/4] ipvs: Consistently use array_size() in ip_vs_conn_init() Message-ID: <20230411113450.ky4jp6jsptvlzrtx@soft-dev3-1> References: <20230409-ipvs-cleanup-v2-0-204cd17da708@kernel.org> <20230409-ipvs-cleanup-v2-2-204cd17da708@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20230409-ipvs-cleanup-v2-2-204cd17da708@kernel.org> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS 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 The 04/11/2023 09:10, Simon Horman wrote: > > Consistently use array_size() to calculate the size of ip_vs_conn_tab > in bytes. > > Flagged by Coccinelle: > WARNING: array_size is already used (line 1498) to compute the same size > > No functional change intended. > Compile tested only. Reviewed-by: Horatiu Vultur > > Signed-off-by: Simon Horman > --- > v2 > * Retain division by 1024, which was lost in v1 > --- > net/netfilter/ipvs/ip_vs_conn.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c > index 13534e02346c..84d273a84dc8 100644 > --- a/net/netfilter/ipvs/ip_vs_conn.c > +++ b/net/netfilter/ipvs/ip_vs_conn.c > @@ -1481,6 +1481,7 @@ void __net_exit ip_vs_conn_net_cleanup(struct netns_ipvs *ipvs) > > int __init ip_vs_conn_init(void) > { > + size_t tab_array_size; > int idx; > > /* Compute size and mask */ > @@ -1494,8 +1495,9 @@ int __init ip_vs_conn_init(void) > /* > * Allocate the connection hash table and initialize its list heads > */ > - ip_vs_conn_tab = vmalloc(array_size(ip_vs_conn_tab_size, > - sizeof(*ip_vs_conn_tab))); > + tab_array_size = array_size(ip_vs_conn_tab_size, > + sizeof(*ip_vs_conn_tab)); > + ip_vs_conn_tab = vmalloc(tab_array_size); > if (!ip_vs_conn_tab) > return -ENOMEM; > > @@ -1508,10 +1510,8 @@ int __init ip_vs_conn_init(void) > return -ENOMEM; > } > > - pr_info("Connection hash table configured " > - "(size=%d, memory=%ldKbytes)\n", > - ip_vs_conn_tab_size, > - (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024); > + pr_info("Connection hash table configured (size=%d, memory=%zdKbytes)\n", > + ip_vs_conn_tab_size / 1024, tab_array_size); > IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n", > sizeof(struct ip_vs_conn)); > > > -- > 2.30.2 > -- /Horatiu