All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 4/4] nvmet: fix byte swap in nvmet_parse_io_cmd
Date: Fri, 31 Mar 2017 17:00:08 +0200	[thread overview]
Message-ID: <20170331150008.16034-5-hch@lst.de> (raw)
In-Reply-To: <20170331150008.16034-1-hch@lst.de>

We need to do arithmetics after byte swapping, not before.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 drivers/nvme/target/io-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/io-cmd.c b/drivers/nvme/target/io-cmd.c
index e37acd77b5fe..6b0baa9caab9 100644
--- a/drivers/nvme/target/io-cmd.c
+++ b/drivers/nvme/target/io-cmd.c
@@ -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:
-- 
2.11.0

  parent reply	other threads:[~2017-03-31 15:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 15:00 trivial nvme fixes for 4.11 Christoph Hellwig
2017-03-31 15:00 ` [PATCH 1/4] nvme: add missing byte swap in nvme_setup_discard Christoph Hellwig
2017-03-31 15:00 ` [PATCH 2/4] nvmet: add missing byte swap in nvmet_get_smart_log Christoph Hellwig
2017-03-31 15:00 ` [PATCH 3/4] nvmet: fix byte swap in nvmet_execute_write_zeroes Christoph Hellwig
2017-03-31 15:00 ` Christoph Hellwig [this message]
2017-04-02  8:14 ` trivial nvme fixes for 4.11 Max Gurtovoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170331150008.16034-5-hch@lst.de \
    --to=hch@lst.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.