Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl: Add warning comment to cxl_root_decoder
@ 2023-04-26 23:00 Dave Jiang
  2023-04-27  4:03 ` Alison Schofield
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2023-04-26 23:00 UTC (permalink / raw)
  To: linux-cxl; +Cc: dan.j.williams, vishal.l.verma, alison.schofield, ira.weiny

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>
---
 drivers/cxl/cxl.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 044a92d9813e..999c0aa5ed54 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;
+	/* This must be the last member of the struct. It contains a flexible array */
 	struct cxl_switch_decoder cxlsd;
 };
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-27  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-26 23:00 [PATCH] cxl: Add warning comment to cxl_root_decoder Dave Jiang
2023-04-27  4:03 ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox