Skip to content

Commit 355ca20

Browse files
committed
ioctl: Rearrange members in nvme_security_receive_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_receive_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 al; /* 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 bd6f919 commit 355ca20

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
@@ -2971,31 +2971,31 @@ int nvme_security_send(struct nvme_security_send_args *args);
29712971
/**
29722972
* nvme_security_receive_args - Arguments for the NVMe Security Receive command
29732973
* @fd: File descriptor of nvme device
2974+
* @result: The command completion result from CQE dword0
2975+
* @timeout: Timeout in ms
29742976
* @nsid: Namespace ID to issue security command on
29752977
* @nssf: NVMe Security Specific field
29762978
* @spsp0: Security Protocol Specific field
29772979
* @spsp1: Security Protocol Specific field
29782980
* @secp: Security Protocol
29792981
* @al: Protocol specific allocation length
2980-
* @data_len: Data length of the payload in bytes
29812982
* @data: Security data payload to send
2982-
* @timeout: Timeout in ms
2983-
* @result: The command completion result from CQE dword0
2983+
* @data_len: Data length of the payload in bytes
29842984
*/
29852985
struct nvme_security_receive_args {
29862986
int args_size;
29872987
int fd;
2988+
__u32 *result;
2989+
__u32 timeout;
29882990
__u32 nsid;
29892991
__u8 nssf;
29902992
__u8 spsp0;
29912993
__u8 spsp1;
29922994
__u8 secp;
29932995
__u32 al;
2994-
__u32 data_len;
29952996
void *data;
2996-
__u32 timeout;
2997-
__u32 *result;
2998-
};
2997+
__u32 data_len;
2998+
} __attribute__((packed, aligned(__alignof__(__u32*))));
29992999

30003000
/**
30013001
* nvme_security_receive() -

0 commit comments

Comments
 (0)