lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210413165313.GA1430582@infradead.org>
Date:   Tue, 13 Apr 2021 17:53:13 +0100
From:   Christoph Hellwig <hch@...radead.org>
To:     "Darrick J. Wong" <djwong@...nel.org>
Cc:     Christoph Hellwig <hch@...radead.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH v4][next] xfs: Replace one-element arrays with
 flexible-array members

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ