nvmet: Make dsm number of ranges zero based
authorAlexander Solganik <sashas@lightbitslabs.com>
Wed, 21 Sep 2016 21:12:38 +0000 (14:12 -0700)
committerSagi Grimberg <sagi@grimberg.me>
Fri, 23 Sep 2016 22:37:38 +0000 (15:37 -0700)
This caused the nvmet request data length to be
incorrect.

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

index 4132b6b9818233290940c62cb6b4e0d7e499e48a..4a96c2049b7b6be310ea0e818fa29bb39db108d0 100644 (file)
@@ -206,7 +206,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) *
+               req->data_len = le32_to_cpu(cmd->dsm.nr + 1) *
                        sizeof(struct nvme_dsm_range);
                return 0;
        default: