Skip to content

Commit 8a66487

Browse files
AlisonSchofielddjbw
authored andcommitted
cxl/mbox: Use __le32 in get,set_lsa mailbox structures
CXL specification defines these as little endian. Fixes: 60b8f17 ("cxl/pmem: Translate NVDIMM label commands to CXL label commands") Reported-by: Dan Williams <[email protected]> Signed-off-by: Alison Schofield <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Williams <[email protected]>
1 parent 8ae3ceb commit 8a66487

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/cxl/cxlmem.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ struct cxl_mbox_identify {
300300
} __packed;
301301

302302
struct cxl_mbox_get_lsa {
303-
u32 offset;
304-
u32 length;
303+
__le32 offset;
304+
__le32 length;
305305
} __packed;
306306

307307
struct cxl_mbox_set_lsa {
308-
u32 offset;
309-
u32 reserved;
308+
__le32 offset;
309+
__le32 reserved;
310310
u8 data[];
311311
} __packed;
312312

drivers/cxl/pmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ static int cxl_pmem_get_config_data(struct cxl_dev_state *cxlds,
108108
return -EINVAL;
109109

110110
get_lsa = (struct cxl_mbox_get_lsa) {
111-
.offset = cmd->in_offset,
112-
.length = cmd->in_length,
111+
.offset = cpu_to_le32(cmd->in_offset),
112+
.length = cpu_to_le32(cmd->in_length),
113113
};
114114

115115
rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_LSA, &get_lsa,
@@ -139,7 +139,7 @@ static int cxl_pmem_set_config_data(struct cxl_dev_state *cxlds,
139139
return -ENOMEM;
140140

141141
*set_lsa = (struct cxl_mbox_set_lsa) {
142-
.offset = cmd->in_offset,
142+
.offset = cpu_to_le32(cmd->in_offset),
143143
};
144144
memcpy(set_lsa->data, cmd->in_buf, cmd->in_length);
145145

0 commit comments

Comments
 (0)