Re: [PATCH v2][next] RDMA/cm: Avoid -Wflex-array-member-not-at-end warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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")

-Gustavo




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux