Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp222745pxv; Wed, 14 Jul 2021 02:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaRJoiUsp2s8NVX+hOK0bk+iVJcbGL/aOs1KtMJPFB+iTkorMW82ohpE0/lyGIHTaHZgOP X-Received: by 2002:a05:6638:3a4:: with SMTP id z4mr8051334jap.65.1626254928055; Wed, 14 Jul 2021 02:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626254928; cv=none; d=google.com; s=arc-20160816; b=sN5NUzqoiJ2XgogzyAYcZ8j0vTJKlkiuGwjOnmfduw/GIHQsY7c2bsdthazjkFYFKv 5JYxqXvIQXOfHuRAFfJbJBMZUX/6980Hi7Fg0AMWeR3efw/tDXEpBAUIyQJQZgWYMV50 E/QMAy1DYt1Dg9/ratvJbnU9voiOHubRKVnK9WperZnpHG6Er94aV+9E1MmMbbef+5fp zL3jrkbFyJJcnerACRKbw6MzPd6TJ1ed09FIgGae8Xt8DfiqKWroQH0U55CnaNlWlrAd O/guw+Ld6+8YdtA87q6mLe/gV3381S6ZWOpPTsb2vk0s4yIXff48o9JVXC9OMicoEmJJ TfYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=eyvoFH7sizyAdS3Rq1N4JkiGBINN7uLMB0XVBpXKQqY=; b=F7lapDeLQ+TrRryn5xUinA2SmvWruoUuP+GeqZ6FwKH651TH5SskFDk/QZc+A1tBQ2 lBGtyI7hroXLrgfx5TLk46RYpAJe0h4Ki97ju2TfAlf0nSsPaP1RjublLwGmO421n9Lv vb7R6lu7XFuJU11ydOtVknLmmIQg7axBjD2kERoCB/Cr2aWIgjvFcddzlm2lq6g51WNO YHf4HvvkfnxD/M9ZNGU1x/So7d2VuqBBStUpTadZ59l/XHo8HTOEzA19hmsYahBmseoA nMXjlTo4DHI+lbD+ypBf4bRtRBfleMdv4JbCKj9VLovQ70NI3GFd2ajGlZpqq+eLND5Q GGMA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m8si2266186iow.20.2021.07.14.02.28.35; Wed, 14 Jul 2021 02:28:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238362AbhGNJaw (ORCPT + 99 others); Wed, 14 Jul 2021 05:30:52 -0400 Received: from mga03.intel.com ([134.134.136.65]:19138 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238189AbhGNJaw (ORCPT ); Wed, 14 Jul 2021 05:30:52 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10044"; a="210358873" X-IronPort-AV: E=Sophos;i="5.84,238,1620716400"; d="scan'208";a="210358873" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2021 02:27:58 -0700 X-IronPort-AV: E=Sophos;i="5.84,238,1620716400"; d="scan'208";a="494390723" Received: from rongch2-mobl.ccr.corp.intel.com (HELO [10.249.169.74]) ([10.249.169.74]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2021 02:27:56 -0700 Subject: Re: [PATCH v4][next] xfs: Replace one-element arrays with flexible-array members To: Christoph Hellwig , "Darrick J. Wong" Cc: "Gustavo A. R. Silva" , linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20210412135611.GA183224@embeddedor> <20210412152906.GA1075717@infradead.org> <20210412154808.GA1670408@magnolia> <20210413165313.GA1430582@infradead.org> From: "Chen, Rong A" Message-ID: Date: Wed, 14 Jul 2021 17:27:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210413165313.GA1430582@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/14/2021 12:53 AM, Christoph Hellwig wrote: > On Mon, Apr 12, 2021 at 08:48:08AM -0700, Darrick J. Wong wrote: >> 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. > > Which doesn't really work with struct_size or rather leads to a mess > like the above as struct_size really wants a variable and not just a > type. Making it really nasty for both allocations and creating slab > caches. I tried to find a workaround for that, but that makes the > compiler unhappy based its inlining heuristics. > > Anyway, a lot of the helpers are pretty silly as they duplicate stuff > without cleaning up the underlying mess. I tried to sort much of this > out here, still WIP: > > http://git.infradead.org/users/hch/xfs.git/shortlog/refs/heads/xfs-array-size > Hi xfs maintainers, Kindly ping, is there any new progress on this patch series? Best Regards, Rong Chen