From nobody Wed Feb 11 16:31:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1022BC77B75 for ; Sat, 6 May 2023 16:04:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229505AbjEFQE1 (ORCPT ); Sat, 6 May 2023 12:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjEFQEX (ORCPT ); Sat, 6 May 2023 12:04:23 -0400 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B3510DE for ; Sat, 6 May 2023 09:04:21 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id vKOPpaWk2Mk9uvKOQpAa5h; Sat, 06 May 2023 18:04:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1683389060; bh=0FotBQHha+qZRI5XXIk6G0iRigNGwWlnzMiCXh1rLH4=; h=From:To:Cc:Subject:Date; b=hzhoxFp4qyXukAuHJwGCYHcARfYcqtaflHFyYmnwCigie8I9Dkr0YB30gX/hsHSDH 82HIL/wNNcR/7rkugu9UBXo4MG0m+SFLSc/luFK5VbaQzEqA6fnbEUwvVBcqKu+eSQ FsaUvN9pb0a311jkTEzOvsokL9rtmSS6VNoslvbPgEeMx1PVIjJhepH3BqegU5+TKA RH7zhU2aND9zTSbmOi38vS3auJLVG/tdPEg2wceGnLS1Jh3TKzgQVrQgApvUvAFHMA p/XH7iws/UBPoiW5cZmJun5f2YIZ+pZME0lKx4ast4MF3UZg51mUydDGsqpZ2q6bqC 2vGIF8YaYvSDQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 06 May 2023 18:04:20 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Pravin B Shelar , "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, dev@openvswitch.org Subject: [PATCH net-next] net: openvswitch: Use struct_size() Date: Sat, 6 May 2023 18:04:16 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use struct_size() instead of hand writing it. This is less verbose and more informative. Signed-off-by: Christophe JAILLET Acked-by: Eelco Chaudron --- It will also help scripts when __counted_by macro will be added. See [1]. [1]: https://lore.kernel.org/all/6453f739.170a0220.62695.7785@mx.google.com/ --- net/openvswitch/meter.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c index f2698d2316df..c4ebf810e4b1 100644 --- a/net/openvswitch/meter.c +++ b/net/openvswitch/meter.c @@ -69,9 +69,7 @@ static struct dp_meter_instance *dp_meter_instance_alloc(= const u32 size) { struct dp_meter_instance *ti; =20 - ti =3D kvzalloc(sizeof(*ti) + - sizeof(struct dp_meter *) * size, - GFP_KERNEL); + ti =3D kvzalloc(struct_size(ti, dp_meters, size), GFP_KERNEL); if (!ti) return NULL; =20 --=20 2.34.1