nvmet: fix byte swap in nvmet_parse_io_cmd
authorChristoph Hellwig <hch@lst.de>
Fri, 31 Mar 2017 15:00:08 +0000 (17:00 +0200)
committerSagi Grimberg <sagi@grimberg.me>
Sun, 2 Apr 2017 07:24:15 +0000 (10:24 +0300)
We need to do arithmetics after byte swapping, not before.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/target/io-cmd.c

index e37acd77b5fe90f717628116b328f91198c3e3f5..6b0baa9caab9fdf524944b0be6e8d011d05c552b 100644 (file)
@@ -230,7 +230,7 @@ int nvmet_parse_io_cmd(struct nvmet_req *req)
                return 0;
        case nvme_cmd_dsm:
                req->execute = nvmet_execute_dsm;
-               req->data_len = le32_to_cpu(cmd->dsm.nr + 1) *
+               req->data_len = (le32_to_cpu(cmd->dsm.nr) + 1) *
                        sizeof(struct nvme_dsm_range);
                return 0;
        case nvme_cmd_write_zeroes: