block/nvme: Fix nvme_submit_command() on big-endian host
commita0546a7b6f14a919b67cea1d1fc4362ac2901868
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 29 Oct 2020 09:33:05 +0000 (29 10:33 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 3 Nov 2020 19:06:22 +0000 (3 19:06 +0000)
tree361d643217fd19800cf706fdb4ae344c881986ce
parent4b19e9b8159b5eecf8e90c81c56c1a13547e411a
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: bdd6a90a9e5 ("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>
block/nvme.c