Re: [PATCH][next] xfs: Replace one-element arrays with flexible-array members

From: Gustavo A. R. Silva
Date: Tue Mar 09 2021 - 17:29:33 EST




On 3/9/21 15:26, Darrick J. Wong wrote:
>>> It seems to work all right for casted NULL pointers, and then we get all
>>> the typechecking and multiplication overflow checking, e.g.:
>>>
>>> size_t len64 = struct_size((struct xfs_efi_log_format_32 *)NULL,
>>> efi_extents src_efi_fmt->efi_nextents);
>> Yeah; in that case, what do you think about casting 0, instead of NULL:
>>
>> uint len32 = struct_size((xfs_efi_log_format_32_t *)0, efi_extents,
>> src_efi_fmt->efi_nextents);
>> uint len64 = struct_size((xfs_efi_log_format_64_t *)0, efi_extents,
>> src_efi_fmt->efi_nextents);
> I don't have a preference either way, either here or for the half-dozen
> more of these scattered elsewhere in the file.

OK. I'll send v2, shortly

Thanks for the feedback!
--
Gustavo