Skip to content

Commit 46a2473

Browse files
committed
ioctl: Rearrange members in nvme_fw_download_args
Avoid any holes in the struct by rearranging the members. Also add the attribute packed to struct definition to reduce ABI breakage. struct nvme_fw_download_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 offset; /* 20 4 */ void * data; /* 24 8 */ __u32 data_len; /* 32 4 */ /* size: 40, cachelines: 1, members: 7 */ /* padding: 4 */ /* last cacheline: 40 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent 30df2e1 commit 46a2473

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/nvme/ioctl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,21 +2850,21 @@ static inline int nvme_ns_detach_ctrls(int fd, __u32 nsid,
28502850
/**
28512851
* nvme_fw_download_args - Arguments for the NVMe Firmware Download command
28522852
* @fd: File descriptor of nvme device
2853+
* @result: The command completion result from CQE dword0
2854+
* @timeout: Timeout in ms
28532855
* @offset: Offset in the firmware data
2854-
* @data_len: Length of data in this command in bytes
28552856
* @data: Userspace address of the firmware data
2856-
* @timeout: Timeout in ms
2857-
* @result: The command completion result from CQE dword0
2857+
* @data_len: Length of data in this command in bytes
28582858
*/
28592859
struct nvme_fw_download_args {
28602860
int args_size;
28612861
int fd;
2862+
__u32 *result;
2863+
__u32 timeout;
28622864
__u32 offset;
2863-
__u32 data_len;
28642865
void *data;
2865-
__u32 timeout;
2866-
__u32 *result;
2867-
};
2866+
__u32 data_len;
2867+
} __attribute__((packed, aligned(__alignof__(__u32*))));
28682868

28692869
/**
28702870
* nvme_fw_download() - Download part or all of a firmware image to the

0 commit comments

Comments
 (0)