linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2][next] RDMA/cm: Avoid -Wflex-array-member-not-at-end warning
Date: Tue, 26 Aug 2025 06:43:55 +0200	[thread overview]
Message-ID: <aa568cd4-3bfc-4eac-8a49-eb4cf7cf7331@embeddedor.com> (raw)
In-Reply-To: <20250825172020.GA2077724@nvidia.com>



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

  reply	other threads:[~2025-08-26  4:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 10:22 [PATCH v2][next] RDMA/cm: Avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-08-25 17:20 ` Jason Gunthorpe
2025-08-26  4:43   ` Gustavo A. R. Silva [this message]
2025-08-26 12:00     ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa568cd4-3bfc-4eac-8a49-eb4cf7cf7331@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).