summaryrefslogtreecommitdiffstats
path: root/src/nvme/mi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvme/mi.c')
-rw-r--r--src/nvme/mi.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/nvme/mi.c b/src/nvme/mi.c
index 3799f35..82ed88a 100644
--- a/src/nvme/mi.c
+++ b/src/nvme/mi.c
@@ -413,11 +413,6 @@ int nvme_mi_submit(nvme_mi_ep_t ep, struct nvme_mi_req *req,
return -1;
}
- if (resp->data_len & 0x3) {
- errno = EINVAL;
- return -1;
- }
-
if (ep->transport->mic_enabled)
nvme_mi_calc_req_mic(req);
@@ -580,8 +575,10 @@ int nvme_mi_admin_xfer(nvme_mi_ctrl_t ctrl,
return -1;
}
- /* must be aligned */
- if (resp_data_offset & 0x3) {
+ /* request and response lengths & offset must be aligned */
+ if ((req_data_size & 0x3) ||
+ (*resp_data_size & 0x3) ||
+ (resp_data_offset & 0x3)) {
errno = EINVAL;
return -1;
}
@@ -1051,7 +1048,7 @@ int nvme_mi_admin_set_features(nvme_mi_ctrl_t ctrl,
nvme_admin_set_features);
req_hdr.cdw1 = cpu_to_le32(args->nsid);
- req_hdr.cdw10 = cpu_to_le32((args->save ? 1 : 0) << 31 |
+ req_hdr.cdw10 = cpu_to_le32((__u32)!!args->save << 31 |
(args->fid & 0xff));
req_hdr.cdw14 = cpu_to_le32(args->uuidx & 0x7f);
req_hdr.cdw11 = cpu_to_le32(args->cdw11);
@@ -1223,7 +1220,7 @@ int nvme_mi_admin_fw_commit(nvme_mi_ctrl_t ctrl,
nvme_mi_admin_init_req(&req, &req_hdr, ctrl->id,
nvme_admin_fw_commit);
- req_hdr.cdw10 = cpu_to_le32(((args->bpid & 0x1) << 31) |
+ req_hdr.cdw10 = cpu_to_le32(((__u32)(args->bpid & 0x1) << 31) |
((args->action & 0x7) << 3) |
((args->slot & 0x7) << 0));