Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3026704rdg; Tue, 17 Oct 2023 02:11:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRZchSYcBzPeQFwDBIhlqTBVe2HyZSyy+BrZNi0yT+ARizyNFukQ1Kj3o4icrWdKK6CvcV X-Received: by 2002:a17:903:228e:b0:1ca:86a9:cace with SMTP id b14-20020a170903228e00b001ca86a9cacemr1792400plh.2.1697533872986; Tue, 17 Oct 2023 02:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697533872; cv=none; d=google.com; s=arc-20160816; b=jyw8fDpKVylVsK5wpK9p5OtpX3mTZdbI2UEJYXYcdFuvAxXG4EnPSbYpZL1Wgl8F0G CMfhoCwf4zYlZQ4ZUE4GJ32Xq0+fwTuRq92EMGeWi5etHy7GKWNEfm7nWRD8h7VJnjCA VzNzo9pU6UfMmbwof8OwzTS2TcdWr1W6A5ANPhI8PjjmWMiR3HZyUDlwc7+0ed413MWr HuB7s85reZ63qlQOLSlHEjJFKUgHdCKdR5KRe8Ok5dUD+IX6+Ks54ZRsvRN20UgvyiTe T7p+kItxX/T7cKYNFgzkyIUlajSoBM6vj3R+QeASgfEWDo4zs8Xeivr2SFCVUAJaBTBT RaVw== 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=pklysrTg2wyKQ+4DFveewWd5LaDCHcdoW4xe0Oqy0UY=; fh=geblsuYft5Q5bWovR00xvs85/up+vnHsMCaf5zK5Udk=; b=vnJp/jytcE6SnFuRfwuUSe+n+SozY5LrLrjR4FOYLPaQCvjGmpy4p5rhjbLdq3vxCn 2qr1gj4iFrdj7eEhungucxTwmw58XkBy0blZIHoVHb+yqm/UkCjUFfbVt0jkDwZhLVn7 CpXp1CPbpjtTBeyZIbdO2hd/e+y8hUL/dg8TvuDT6FHtixWIQ0F/n66arab9VTzJuQj1 ZO0H6VeBzFEq10I3U/mggUCLy1/DesCfNbCuI/rulLHWO/Hm8XhuygAVaXP83MztHO6w Sr+Tkff5C/mv2+f/KpX3WYq0l8qfo5C65f3gdBcFeNjqHbys5PFLzq54eXHnjDW0yX4U Omyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M93MFRgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id la7-20020a170902fa0700b001c5c632aea4si1308297plb.217.2023.10.17.02.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 02:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M93MFRgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 214538053FB1; Tue, 17 Oct 2023 02:10:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234959AbjJQJKN (ORCPT + 99 others); Tue, 17 Oct 2023 05:10:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbjJQJJw (ORCPT ); Tue, 17 Oct 2023 05:09:52 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4677C191; Tue, 17 Oct 2023 02:09:27 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E005CC43395; Tue, 17 Oct 2023 09:09:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697533766; bh=0J00yBt6B+0GI95PaNrYuW82ColdTJxLKzN75HBOfTI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=M93MFRgowGo0xLvNH6mhY5IHz2AkL7yxlNmuE7f59h0T89aSwLaRh0fll8U2VvMMq uYt3SmBdvdMxZKlHcPYonQHU/Lk7OQTer9zwjggGGYnijGlTHRRzgHKzu3ikmbjsuc igoHi5ZtXAC/Dz1s0Irue5hYTRz+YBVW+/Otljrg7SV4207jGrwNcvu0rdLTOEkncr OnAroEb0QT8ruQQ007OAEJQe05hskjvquJ1X7X2Llt7KGT/GkvGWmbBFJEz466qBQE apkoWKiptypCbWpjR0rEg26YlOozMELZfxcFeRAlJJ3v0VrBCmXpClLfXUIy1kMkdb 63Cmh90bJvkdw== Date: Tue, 17 Oct 2023 11:09:22 +0200 From: Simon Horman To: Christophe JAILLET Cc: Pravin B Shelar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , dev@openvswitch.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [ovs-dev] [PATCH v2 1/2] net: openvswitch: Use struct_size() Message-ID: <20231017090922.GQ1751252@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 17 Oct 2023 02:10:50 -0700 (PDT) On Sat, Oct 14, 2023 at 08:34:52AM +0200, Christophe JAILLET wrote: > Use struct_size() instead of hand writing it. > This is less verbose and more robust. > > Signed-off-by: Christophe JAILLET > --- > v2: No change > > v1: https://lore.kernel.org/all/8be59c9e06fca8eff2f264abb4c2f74db0b19a9e.1696156198.git.christophe.jaillet@wanadoo.fr/ > > > This is IMHO more readable, even if not perfect. > > However (untested): > + new = kzalloc(size_add(struct_size(new, masks, size), > size_mul(sizeof(u64), size)), GFP_KERNEL); > looks completely unreadable to me. Thanks, this looks correct (and more readable) to me. Reviewed-by: Simon Horman