block/nvme: Fix nvme_submit_command() on big-endian host
The Completion Queue Command Identifier is a 16-bit value,
so nvme_submit_command() is unlikely to work on big-endian
hosts, as the relevant bits are truncated.
Fix by using the correct byte-swap function.
Fixes: bdd6a90a9e
("block: Add VFIO based NVMe driver")
Reported-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20201029093306.1063879-25-philmd@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
This commit is contained in:
parent
4b19e9b815
commit
a0546a7b6f
@ -469,7 +469,7 @@ static void nvme_submit_command(NVMeQueuePair *q, NVMeRequest *req,
|
|||||||
assert(!req->cb);
|
assert(!req->cb);
|
||||||
req->cb = cb;
|
req->cb = cb;
|
||||||
req->opaque = opaque;
|
req->opaque = opaque;
|
||||||
cmd->cid = cpu_to_le32(req->cid);
|
cmd->cid = cpu_to_le16(req->cid);
|
||||||
|
|
||||||
trace_nvme_submit_command(q->s, q->index, req->cid);
|
trace_nvme_submit_command(q->s, q->index, req->cid);
|
||||||
nvme_trace_command(cmd);
|
nvme_trace_command(cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user