From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <dan.j.williams@intel.com>,
<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
<ira.weiny@intel.com>
Subject: Re: [RESEND PATCH v2] cxl: Warn of flexible array in struct cxl_root_decoder
Date: Thu, 11 May 2023 17:36:35 +0100 [thread overview]
Message-ID: <20230511173635.00005a70@Huawei.com> (raw)
In-Reply-To: <168261044311.369593.10950998135160952191.stgit@djiang5-mobl3>
On Thu, 27 Apr 2023 08:47:23 -0700
Dave Jiang <dave.jiang@intel.com> wrote:
> The 'cxl_switch_decoder' member in 'cxl_root_decoder' must be the last
> element due to 'cxl_switch_decoder' has a flexible array at the
> end of the struct. Any variables placed after will be corrupted.
> Add a warning comment to 'cxl_root_decoder'.
>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Ugly requirement, so comment good to have.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> ---
> v2:
> - Clarify subject (Alison)
> - Fit comment under 80 chars. (Alison)
> ---
> drivers/cxl/cxl.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 044a92d9813e..7db7e217b6f3 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -419,6 +419,7 @@ struct cxl_root_decoder {
> cxl_calc_hb_fn calc_hb;
> void *platform_data;
> struct mutex range_lock;
> + /* Must be the last member. Struct contains a flexible array */
> struct cxl_switch_decoder cxlsd;
> };
>
>
>
prev parent reply other threads:[~2023-05-11 16:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 15:47 [RESEND PATCH v2] cxl: Warn of flexible array in struct cxl_root_decoder Dave Jiang
2023-04-27 17:29 ` Ira Weiny
2023-04-27 19:02 ` Alison Schofield
2023-05-11 16:36 ` Jonathan Cameron [this message]
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=20230511173635.00005a70@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/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