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] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b9c7386-c2b1-2eb7-d248-ddfdc3c2cd1f@embeddedor.com>
Date:   Tue, 23 May 2023 19:11:37 -0600
From:   "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To:     Chuck Lever <cel@...nel.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>
Cc:     Chuck Lever <chuck.lever@...cle.com>,
        Jeff Layton <jlayton@...nel.org>, linux-nfs@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] nfsd: Replace one-element array with flexible-array
 member



On 5/23/23 19:01, Chuck Lever wrote:
> On Tue, May 23, 2023 at 06:44:23PM -0600, Gustavo A. R. Silva wrote:
>> One-element arrays are deprecated, and we are replacing them with
>> flexible array members instead. So, replace a one-element array
>> with a flexible-arrayº member in struct vbi_anc_data and refactor
> 
> I don't know what "struct vbi_anc_data" is. Is the patch description
> correct?

Oops, copy/paste error. I'll fix it up. :)

> 
> 
>> the rest of the code, accordingly.
>>
>> This results in no differences in binary output.
>>
>> Link: https://github.com/KSPP/linux/issues/79
>> Link: https://github.com/KSPP/linux/issues/298
>> Signed-off-by: Gustavo A. R. Silva <gustavoars@...nel.org>
> 
>> ---
>>   fs/nfsd/nfs4callback.c | 2 +-
>>   fs/nfsd/xdr4.h         | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
>> index 4039ffcf90ba..2c688d51135d 100644
>> --- a/fs/nfsd/nfs4callback.c
>> +++ b/fs/nfsd/nfs4callback.c
>> @@ -353,7 +353,7 @@ encode_cb_recallany4args(struct xdr_stream *xdr,
>>   {
>>   	encode_nfs_cb_opnum4(xdr, OP_CB_RECALL_ANY);
>>   	encode_uint32(xdr, ra->ra_keep);
>> -	encode_bitmap4(xdr, ra->ra_bmval, ARRAY_SIZE(ra->ra_bmval));
>> +	encode_bitmap4(xdr, ra->ra_bmval, 1);
> 
> I find the new code less self-documenting.
> 
> 
>>   	hdr->nops++;
>>   }
>>   
>> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
>> index 510978e602da..68072170eac8 100644
>> --- a/fs/nfsd/xdr4.h
>> +++ b/fs/nfsd/xdr4.h
>> @@ -899,7 +899,7 @@ struct nfsd4_operation {
>>   struct nfsd4_cb_recall_any {
>>   	struct nfsd4_callback	ra_cb;
>>   	u32			ra_keep;
>> -	u32			ra_bmval[1];
>> +	u32			ra_bmval[];
> 
> This is not a placeholder for "1 or more elements". We actually want
> just a single u32 element in this array. Doesn't this change the
> sizeof(struct nfsd4_cb_recall_any) ?

I see. Yes, it does change the size. Can we replace it with a simple
object of type u32? or do you actually need this to stay an array?

Thanks
--
Gustav

> 
> 
>>   };
>>   
>>   #endif
>> -- 
>> 2.34.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ