[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad8987ae-b7fe-47af-a1d2-5055749011c0@embeddedor.com>
Date: Fri, 19 Dec 2025 18:55:01 +0900
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Zhu Yanjun <mounter625@....com>, Zhu Yanjun <yanjun.zhu@...ux.dev>,
Leon Romanovsky <leon@...nel.org>
Cc: Jason Gunthorpe <jgg@...dia.com>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>,
Zhu Yanjun <zyjzyj2000@...il.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] RDMA/rxe: Avoid -Wflex-array-member-not-at-end
warnings
On 12/19/25 15:59, Zhu Yanjun wrote:
>
> 在 2025/12/18 21:48, Gustavo A. R. Silva 写道:
>>
>>> The struct rxe_recv_wqe is as below.
>>>
>>> struct rxe_recv_wqe {
>>> __aligned_u64 wr_id;
>>> __u32 reserved;
>>> __u32 padding;
>>> struct rxe_dma_info dma;
>>
>> Expand struct rxe_dma_info here.
>
> Thanks. In struct rxe_dma_info, the struct is
>
> struct rxe_sge {
> __aligned_u64 addr;
> __u32 length;
> __u32 lkey;
> };
>
> But in your commit, struct ib_sge is used.
>
> struct ib_sge {
> u64 addr;
> u32 length;
> u32 lkey;
> };
> __aligned_u64 is a 64-bit integer with a guaranteed 8-byte alignment,
>
> used to preserve ABI correctness across architectures and between
>
> userspace and kernel, while u64 has architecture-dependent alignment.
>
> I am not sure if we can treate "struct rxe_sge" as the same with "struct ib_sge".
Just notice that the original code is the one actually doing that.
See my response in this same thread:
https://lore.kernel.org/linux-hardening/d3336e9d-2b84-4698-a799-b49e3845f38f@embeddedor.com/
So, if that code is fine, this is fine. If the original code is wrong,
then that code should be fixed first.
-Gustavo
>
>
> Leon and Jason, please comment on it.
>
>
> Yanjun.Zhu
>
>>
>>> };
>>>
>>> But I can not find dma.sge in the above struct. Can you explain it?
>>>
>>> To be honest, I read your original commit for several times, but I can not get it. Can you explain the MACRO TRAILING_OVERLAP? And how can it replace the
>>> following struct?
>>
>> This is clearly explained in the changelog text. I think what you're
>> missing will be clear once you understand how nested structures
>> work. See my comment above.
>>
>> -Gustavo
>
Powered by blists - more mailing lists