Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1882634pxb; Mon, 12 Apr 2021 08:50:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyGzAg7z+xJun2Yf7Im5wdNjTPDiH4HcR3P+vkZIUK0AJXhgWj8F3jGmW22TuimFGRRmfH X-Received: by 2002:aa7:c9cb:: with SMTP id i11mr15206102edt.219.1618242620433; Mon, 12 Apr 2021 08:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618242620; cv=none; d=google.com; s=arc-20160816; b=Qrub6oPAFAdBKQRxFjRLEPj5T/6cMY4MS0R8ydYw4VRoKeBRl4KH1L+PMQ2jc6G1Vq WeQIQCFDKHqteTic19oBP5ZMJWdvgAGm1ZNEHjh2EtLnNGr828lbcy/I5g4FgRMzRK1X LyylzO+tA+BiyvQhZiq0YYvHoaErF5GGNfxf1bTh9gsf3JUbIdY7Bg9GGU019KswqsFB x3edF4ygrgt1xpGPwKtKe9qy7UZr3c+gn0/E7+X518w/1lfRaDUOSpDmr0PSV92o3J2e z0MNilSEFZoGKcakL20Mi7qx4akhFd11jbZ1mnUiGysemqjgo2GVCRzFvDZ32Slofjdg LB9Q== 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=d+1+GzP0E2LAEr4rmJUw/UMmNnPzcyU8+g4ScBHq56w=; b=r7acCYKOYQBC+EeCKker3odEhP92o845cdq+sSumaW4wr8cuC24YM6z4ecIj3+MqVT Je3qnZ6awjAEjhNILcqrGmljQTWfr5sc7J6bDhrFxNGR5PVYZDTndeOp3k3Gqu0ECUPa CvAW9fyvEMhXQHwp9UeKsTJIhkeS9fwy2z4BrZnRvqK2rpaw2uImG/Esc7xXc9yjIk3d vBcmuH9rCzMhWKf04it4d1xWsPc6Oj9ij/iMNe2SNLOFysHI82XwVMe4l+L1+kNwhPa2 sG3CCey7rNit/lutu1Yq0yaxtsSlAxZqAsDg00KadB3hRiT5Q6awhWjCOewk0SiAhW7d N+DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pnSJay4z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si8224848ede.153.2021.04.12.08.49.57; Mon, 12 Apr 2021 08:50:20 -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=@kernel.org header.s=k20201202 header.b=pnSJay4z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242975AbhDLPsc (ORCPT + 99 others); Mon, 12 Apr 2021 11:48:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:49792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239633AbhDLPs1 (ORCPT ); Mon, 12 Apr 2021 11:48:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 796BD61246; Mon, 12 Apr 2021 15:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618242489; bh=8vRE2sT1b6eDattSfR7ri5RJ2qCaH8JeKxz5WPXcorU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pnSJay4zP25POtLTscvF2z5mWetO++/0dMpHer+DMUKEUVwLkOsg9fAeauFaOWt+o 9ZijoYP72WrFmWFWd+9i7OY8W4gnkqWJ+ym8y46O1HtNI/cqJAq1lTa8/nx7prTSTD UEZRNVvKvX0ZF1qQe0UStduK5A9dx2opS5KESYQKPc1C8/g2Gu7AsmL7TZbi4S84Pq l4XKVJHE/iC8j+8nMDA4/HHdwCFx0MYQRh/ROFPM54W6yQgpUl3YJr3/Qg4o6WCH9r /uvaXow8wvo6R64UVeoxH80ng7tM0v0D+20L/tlEEZd4MUp6SbHtenpLNqSVLTBY0n AfJ3bJSnM63mg== Date: Mon, 12 Apr 2021 08:48:08 -0700 From: "Darrick J. Wong" To: Christoph Hellwig Cc: "Gustavo A. R. Silva" , 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: <20210412154808.GA1670408@magnolia> References: <20210412135611.GA183224@embeddedor> <20210412152906.GA1075717@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210412152906.GA1075717@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 12, 2021 at 04:29:06PM +0100, Christoph Hellwig wrote: > > 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. Agreed, please don't post fstests output in the commit message. > > +/* > > + * 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. A couple of revisions ago I specifically asked Gustavo to create these 'silly' sizeof helpers to clean up... > > - (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), ...these even uglier multiline statements. I was also going to ask for these kmem cache users to get cleaned up. I'd much rather look at: xfs_efi_zone = kmem_cache_create("xfs_efi_item", sizeof_xfs_efi(XFS_EFI_MAX_FAST_EXTENTS), 0); if (!xfs_efi_zone) goto the_drop_zone; even if it means another static inline. --D > > + 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.