From: sashiko-bot@kernel.org
To: lirongqing <lirongqing@baidu.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH v2] RDMA/mlx5: Use DEFINE_RAW_FLEX for leftovers flow attributes
Date: Fri, 18 Sep 2026 09:37:08 +0000 [thread overview]
Message-ID: <20260918093709.2619A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260918092337.2338-1-lirongqing@baidu.com>
> From: Li RongQing <lirongqing@baidu.com>
>
> Commit e91fb8b9d0ed ("RDMA/mlx5: Avoid flexible array warning") split
> the leftovers_specs[] array into two separate structs to silence the
> sparse "array of flexible structures" warning, but in doing so reversed
> the member order: eth_flow was placed before flow_attr.
>
> _create_flow_rule() locates the flow specs with:
>
> ib_flow = (void *)flow_attr + sizeof(*flow_attr);
>
> which expects the spec data to immediately follow the ib_flow_attr.
> With the reversed order, flow_attr is the last member, so ib_flow
> points past the end of the struct and the num_of_specs = 1 loop reads
> out-of-bounds memory (whatever static data follows in the .data
> section), producing incorrect flow rules or a crash.
>
> Rebuild the leftovers attributes with DEFINE_RAW_FLEX(), which declares
> an on-stack struct ib_flow_attr with a properly sized trailing flows[]
> array. The ETH spec lives in flows[0].eth at exactly the offset
> _create_flow_rule() expects, so no layout-dependent composite struct is
> needed. This also avoids embedding a structure that contains a flexible
> array member as a non-last member, which would trigger
> -Wflex-array-member-not-at-end once the warning is enabled.
>
> Fixes: e91fb8b9d0ed ("RDMA/mlx5: Avoid flexible array warning")
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918092337.2338-1-lirongqing@baidu.com?part=1
next prev parent reply other threads:[~2026-09-18 9:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 9:23 [PATCH v2] RDMA/mlx5: Use DEFINE_RAW_FLEX for leftovers flow attributes lirongqing
2026-09-18 9:37 ` sashiko-bot [this message]
2026-09-23 12:44 ` Leon Romanovsky
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=20260918093709.2619A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=sashiko-reviews@lists.linux.dev \
/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