Skip to content

Commit bd6f919

Browse files
committed
ioctl: Rearrange members in nvme_security_send_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_security_send_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ __u8 nssf; /* 24 1 */ __u8 spsp0; /* 25 1 */ __u8 spsp1; /* 26 1 */ __u8 secp; /* 27 1 */ __u32 tl; /* 28 4 */ void * data; /* 32 8 */ __u32 data_len; /* 40 4 */ /* size: 48, cachelines: 1, members: 12 */ /* padding: 4 */ /* last cacheline: 48 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent b289574 commit bd6f919

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
@@ -2924,31 +2924,31 @@ int nvme_fw_commit(struct nvme_fw_commit_args *args);
29242924
/**
29252925
* nvme_security_send_args - Arguments for the NVMe Security Send command
29262926
* @fd: File descriptor of nvme device
2927+
* @result: The command completion result from CQE dword0
2928+
* @timeout: Timeout in ms
29272929
* @nsid: Namespace ID to issue security command on
29282930
* @nssf: NVMe Security Specific field
29292931
* @spsp0: Security Protocol Specific field
29302932
* @spsp1: Security Protocol Specific field
29312933
* @secp: Security Protocol
29322934
* @tl: Protocol specific transfer length
2933-
* @data_len: Data length of the payload in bytes
29342935
* @data: Security data payload to send
2935-
* @timeout: Timeout in ms
2936-
* @result: The command completion result from CQE dword0
2936+
* @data_len: Data length of the payload in bytes
29372937
*/
29382938
struct nvme_security_send_args {
29392939
int args_size;
29402940
int fd;
2941+
__u32 *result;
2942+
__u32 timeout;
29412943
__u32 nsid;
29422944
__u8 nssf;
29432945
__u8 spsp0;
29442946
__u8 spsp1;
29452947
__u8 secp;
29462948
__u32 tl;
2947-
__u32 data_len;
29482949
void *data;
2949-
__u32 timeout;
2950-
__u32 *result;
2951-
};
2950+
__u32 data_len;
2951+
} __attribute__((packed, aligned(__alignof__(__u32*))));
29522952

29532953
/**
29542954
* nvme_security_send() -

0 commit comments

Comments
 (0)