Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1869694pxb; Mon, 12 Apr 2021 08:31:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcuOUGkQVTD9HG88GYzWyqkDdbAga+J8QRsz9H4b2NiePQXXUS+cP3mrRUbejiLc1D21MU X-Received: by 2002:a50:85cd:: with SMTP id q13mr30365651edh.114.1618241504141; Mon, 12 Apr 2021 08:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618241504; cv=none; d=google.com; s=arc-20160816; b=o/b1PP+joKDBEmUrx5fjs+HLpxmpue4bE/QeCX+IItRhyb5pUp6mcHv6gvjCEnzg/P lrkJ7n7axt1u4LRBL4uXAQGYAO7Kgsckkf1oAZ1Ud4LSqI3MUhSxIyEZdbDKn5QVz0Ph 3lcmOzsWqDtJWwXc19J6yDmFaNvtYPXSw46Iepp62j20cvv0Y/oZH5c6n7F9HgkeOc8p LzdtRxeNGnoQR3MGwKIX+Ocx2AzOUm38pBV7ynzKYRn8VLu2FFVf9cks1bZGM78gSTAD xIJyu9AinGgidiU4UxIOcOJ50KrgbsWkxOVnezhBophe7tQxTLI6pRirTA0R2zjUcqgQ slTg== 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=mfGd7IdvphAsvIi/1CcWLKElOLtr8R1Sz6OZc2D1oss=; b=GMguBCwL5uZNlEMf3zT5O8K/ALdlMJFbjGhWsZ7BX+B25xZLaZsIpnpF5x6JAqRky8 TuK40jW2m+XYNGNAoJAbZ+u9XQvOyzKo5uRkFu1Z+yg3I6CjQEDNrPPZjQz4xJBZSjnh ldQsWKo5qCfp5b5eHDBMoXI8Z/cUP9Bk/e9pd7IgczEXu/Jqw0HTEH8K2EL3L/iQFNjY ATRGyqFdb+8YlXuK+P4APSgfgR2j7EGevaFWVe87K80AGdFY1pLDgDdPcR27uh6kldpM 0+9SaN1mlVEIkrhLWPOISlYW3r3VvcyMd8ELLxqduPqfOCzbZ+UzbpsuA33zMp/1uzXj XBjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KsckI0GV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p9si3072695ejx.574.2021.04.12.08.31.17; Mon, 12 Apr 2021 08:31:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KsckI0GV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242174AbhDLP32 (ORCPT + 99 others); Mon, 12 Apr 2021 11:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241183AbhDLP31 (ORCPT ); Mon, 12 Apr 2021 11:29:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50371C061574; Mon, 12 Apr 2021 08:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mfGd7IdvphAsvIi/1CcWLKElOLtr8R1Sz6OZc2D1oss=; b=KsckI0GV46bB3x1jMMvW2bROBW lvJX1Ie2dGH9u7C08dTB7bvov0Ai0xeRbpTyxj+n1Hab1wNtuA8mjVzRxWv3HUUR2TUpRorbDrkD9 sx5+TT1VdNE5lS1mI99ou7aDhGfJxVuyfe+C8FTckZ0I0mdoHxARk7qTWylm8p6IUcbYGfVaP5F2c dtgfAdwUpqfbwU53LWwpf0NQ+VvPKHW3yV8U3kZm1ivwuM72yRKV3hJq5t08sD456iW/dBt03Bv9e 1X6UQRjEzVQJA657opYmuD/O9EJiV/t4SLntWYj1pp44rviKClryCd0rV93kj5yYNA8/sVM5qibXI zD01kCDQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lVyUs-004WGl-OO; Mon, 12 Apr 2021 15:29:06 +0000 Date: Mon, 12 Apr 2021 16:29:06 +0100 From: Christoph Hellwig To: "Gustavo A. R. Silva" Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v4][next] xfs: Replace one-element arrays with flexible-array members Message-ID: <20210412152906.GA1075717@infradead.org> References: <20210412135611.GA183224@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210412135611.GA183224@embeddedor> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Below are the results of running xfstests for "all" with the following > configuration in local.config: ... > Other tests might need to be run in order to verify everything is working > as expected. For such tests, the intervention of the maintainers might be > needed. This is a little weird for a commit log. If you want to show results this would be something that goes into a cover letter. > +/* > + * Calculates the size of structure xfs_efi_log_format followed by an > + * array of n number of efi_extents elements. > + */ > +static inline size_t > +sizeof_efi_log_format(size_t n) > +{ > + return struct_size((struct xfs_efi_log_format *)0, efi_extents, n); These helpers are completely silly. Just keep the existing open code version using sizeof with the one-off removed. > - (sizeof(struct xfs_efd_log_item) + > - (XFS_EFD_MAX_FAST_EXTENTS - 1) * > - sizeof(struct xfs_extent)), > - 0, 0, NULL); > + struct_size((struct xfs_efd_log_item *)0, > + efd_format.efd_extents, > + XFS_EFD_MAX_FAST_EXTENTS), > + 0, 0, NULL); > if (!xfs_efd_zone) > goto out_destroy_buf_item_zone; > > xfs_efi_zone = kmem_cache_create("xfs_efi_item", > - (sizeof(struct xfs_efi_log_item) + > - (XFS_EFI_MAX_FAST_EXTENTS - 1) * > - sizeof(struct xfs_extent)), > + struct_size((struct xfs_efi_log_item *)0, > + efi_format.efi_extents, > + XFS_EFI_MAX_FAST_EXTENTS), Same here. And this obsfucated version also adds completely pointless overly long lines while making the code unreadable.