[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250826120051.GC1970008@nvidia.com>
Date: Tue, 26 Aug 2025 09:00:51 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc: "Gustavo A. R. Silva" <gustavoars@...nel.org>,
Leon Romanovsky <leon@...nel.org>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v2][next] RDMA/cm: Avoid -Wflex-array-member-not-at-end
warning
On Tue, Aug 26, 2025 at 06:43:55AM +0200, Gustavo A. R. Silva wrote:
>
>
> On 25/08/25 19:20, Jason Gunthorpe wrote:
> > On Wed, Aug 13, 2025 at 07:22:14PM +0900, Gustavo A. R. Silva wrote:
> >
> > > @@ -1866,7 +1872,7 @@ static void cm_process_work(struct cm_id_private *cm_id_priv,
> > > int ret;
> >
> > I think if you are going to do this restructing then these lower level
> > functions that never touch the path member should also have their
> > signatures updated to take in the cm_work_hdr not the cm_work struct
> > with the path, and we should never cast from a cm_work_hdr to a
> > cm_work.
> >
> > Basically we should have more type clarity when the path touches are
> > to be sure the cm_timewait_info version never gets into there.
> >
> > And to do that properly is going to need a preparing patch to untangle
> > cm_work_handler() a little bit, it shouldn't be the work function for
> > the cm_timewait_handler() which has a different ype.
> >
> > Also did you look closely at which members needed to be in the hdr?
> > I think with the above it will turn out that some members can be moved
> > to cm_work..
>
> I was wondering if we could just move cm_work at the very end of
> struct cm_timewait_info, like this:
>
> struct cm_timewait_info {
> - struct cm_work work;
> struct list_head list;
> struct rb_node remote_qp_node;
> struct rb_node remote_id_node;
> @@ -204,6 +203,7 @@ struct cm_timewait_info {
> __be32 remote_qpn;
> u8 inserted_remote_qp;
> u8 inserted_remote_id;
> + struct cm_work work;
> };
>
> and then I found this commit 09fb406a569b ("RDMA/cm: Add a note explaining
> how the timewait is eventually freed")
Yeah, it is a messy thing :\
Jason
Powered by blists - more mailing lists