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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b9e2c900-0852-fc5d-9696-835636b4219f@embeddedor.com>
Date:   Wed, 10 Mar 2021 22:28:22 -0600
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     "Darrick J. Wong" <djwong@...nel.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc:     Dave Chinner <david@...morbit.com>, linux-xfs@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] xfs: Replace one-element arrays with
 flexible-array members



On 3/10/21 21:17, Darrick J. Wong wrote:

> Why not use size_t instead of uint?  You converted the @len declaration
> above.
> 
>> +				 src_efi_fmt->efi_nextents);
>> +	uint len64 = struct_size((xfs_efi_log_format_64_t *)0, efi_extents,
> 
> Also, please don't use the struct typedefs, we're trying to get rid of
> those slowly.
> 
> TBH I wonder if these could just be turned into static inline helpers to
> decrapify the code:
> 
> static inline size_t
> sizeof_efi_log_format32(unsigned int nr)
> {
> 	return struct_size((xfs_efi_log_format_32_t *)0, efi_extents, nr);
> }
> 
> Then you only need:
> 
> 	size_t len = sizeof_efi_log_format(src_efi_fmt->efi_nextents);
> 	size_t len32 = sizeof_efi_log_format32(src_efi_fmt->efi_nextents);
> 	size_t len64 = sizeof_efi_log_format64(src_efi_fmt->efi_nextents);
> 
> 	if (len == len32) ...
> 	else if (len == len64) ...
> 
> And down below you can clean up the asserts a bit:
> 
> 	ASSERT(item->ri_buf[0].i_len ==
> 			sizeof_efi_log_format32(efd_formatp->efd_nextents) ||
> 	       item->ri_buf[0].i_len ==
> 			sizeof_efi_log_format64(efd_formatp->efd_nextents));
> 

Done: https://lore.kernel.org/lkml/20210311042302.GA137676@embeddedor/

Thanks for the feedback!
--
Gustavo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ