Blob Blame History Raw
From: Sagi Grimberg <sagi@grimberg.me>
Date: Thu, 15 Jun 2017 16:31:29 +0300
Subject: nvme: don't hard code size of struct t10_pi_tuple
Patch-mainline: v4.13-rc1
Git-commit: 8fa611213d29cd62908adfa2dfd451b2de1737b3
References: FATE#323952, FATE#322506

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d37d444a6902..93edd7e49037 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -356,7 +356,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 	 * unless this namespace is formated such that the metadata can be
 	 * stripped/generated by the controller with PRACT=1.
 	 */
-	if (ns && ns->ms && (!ns->pi_type || ns->ms != 8) &&
+	if (ns && ns->ms &&
+	    (!ns->pi_type || ns->ms != sizeof(struct t10_pi_tuple)) &&
 	    !blk_integrity_rq(req) && !blk_rq_is_passthrough(req))
 		return BLK_STS_NOTSUPP;
 
-- 
2.12.3