Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3184745imj; Mon, 11 Feb 2019 15:42:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ1Fo+NCnelSISqGBd9LcwibWSLAjrBn8k/HE0W/VBDceGFFSYRlZRwiENomfS7cdlnchzz X-Received: by 2002:a63:5402:: with SMTP id i2mr769734pgb.79.1549928571582; Mon, 11 Feb 2019 15:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549928571; cv=none; d=google.com; s=arc-20160816; b=veIrVJbWVXbTBoXLtNzw0ipECwGC7juunIChYDr1vW4QYG4WWn8gMsFRynYELv/GM9 GJpQAn3rmi5HLz48m0fnmtDcMr1HfvtG+Ja8clOQgVbopFLOorgGDfvmnUPc2DA9rTpX sSwQ0JXaIfUH5q5EBNvmOvtt32cKIWkI9947ql4U6O+09R23o+0t81vGle5nW6JlxBVw pH8n7NyPXo9N6vvbZ7Z4p8lOgqCtAKSn6DMd4c2BMAQ0nc+tcWe1qpjiMHrJtZITyAwp ZHw1oqUaXuWOJ2+9Gixku0zeTrwZV/dTkvWP04zZML/ESmH8gAhtdvsGACf+1iCSf2ec 3B+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=LKCFetsNngjGSZAw5RIqfrsajaXw/p3z9vVJ4IxgEOQ=; b=iVmh14FqS3JyuzIAco+QCmVKKOjypgKNFL9aQxcic7xs7DzqvOi9WE1FvcMUk90KfD tLv74lIWh0AfpPxnIH/f6Rry4cwQgG2KJk+0au3FzYJzxjq3qz71o3ywMHNIhe6xHKn2 XjGxaYvIMdZqpxrYNpNzr3Ys+OmGoesfOFRqWCbl/3TYdCKP9bNYjVEzTlp9YHOk7Wp+ yPa5I4hNJ/yWS3aJD12y9YKAtSyw1otxmsL2ChPIXvROkp4wli4kc/1ZkhkNNzl1USQR 6SQIJ87esPxVKzGttCxO+/L0DqVWCmo6TesHVF8HQl2pq5lZkF25Qwf6K84C48itkAM0 ivSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1si276746pgq.36.2019.02.11.15.42.32; Mon, 11 Feb 2019 15:42:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727837AbfBKXkk (ORCPT + 99 others); Mon, 11 Feb 2019 18:40:40 -0500 Received: from mail.us.es ([193.147.175.20]:52250 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbfBKXki (ORCPT ); Mon, 11 Feb 2019 18:40:38 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id F3AB680763 for ; Tue, 12 Feb 2019 00:40:35 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id E0972DA872 for ; Tue, 12 Feb 2019 00:40:35 +0100 (CET) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id D315EDA863; Tue, 12 Feb 2019 00:40:35 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50, SMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id AF039DA84C; Tue, 12 Feb 2019 00:40:33 +0100 (CET) Received: from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); Tue, 12 Feb 2019 00:40:33 +0100 (CET) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int) Received: from us.es (sys.soleta.eu [212.170.55.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 1984lsi) by entrada.int (Postfix) with ESMTPSA id 7A9714265A4C; Tue, 12 Feb 2019 00:40:33 +0100 (CET) Date: Tue, 12 Feb 2019 00:40:33 +0100 X-SMTPAUTHUS: auth mail.us.es From: Pablo Neira Ayuso To: Simon Horman Cc: "Gustavo A. R. Silva" , Wensong Zhang , Julian Anastasov , Jozsef Kadlecsik , Florian Westphal , "David S. Miller" , netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] ipvs: Use struct_size() helper Message-ID: <20190211234033.wwpygxamqwvsuxmv@salvia> References: <20190208004456.GA15845@embeddedor> <20190208095648.la4ushbjxkqgqzb6@verge.net.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190208095648.la4ushbjxkqgqzb6@verge.net.au> User-Agent: NeoMutt/20170113 (1.7.2) X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 08, 2019 at 10:56:48AM +0100, Simon Horman wrote: > On Thu, Feb 07, 2019 at 06:44:56PM -0600, Gustavo A. R. Silva wrote: > > One of the more common cases of allocation size calculations is finding > > the size of a structure that has a zero-sized array at the end, along > > with memory for some number of elements for that array. For example: > > > > struct foo { > > int stuff; > > struct boo entry[]; > > }; > > > > size = sizeof(struct foo) + count * sizeof(struct boo); > > instance = alloc(size, GFP_KERNEL) > > > > Instead of leaving these open-coded and prone to type mistakes, we can > > now use the new struct_size() helper: > > > > size = struct_size(instance, entry, count); > > > > This code was detected with the help of Coccinelle. > > > > Signed-off-by: Gustavo A. R. Silva > > Acked-by: Simon Horman > > Pablo, could you consider applying this? Applied, thanks!