[PATCH 1/7] nvmet-tcp: Don't check data_len in nvmet_tcp_map_data()

From: Logan Gunthorpe
Date: Wed Oct 23 2019 - 12:36:13 EST


None of the other transports check data_len which is verified
in core code. The function should instead check that the sgl length
is non-zero.

Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Reviewed-by: Sagi Grimberg <sagi@xxxxxxxxxxx>
---
drivers/nvme/target/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index d535080b781f..1e2d92f818ad 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -320,7 +320,7 @@ static int nvmet_tcp_map_data(struct nvmet_tcp_cmd *cmd)
struct nvme_sgl_desc *sgl = &cmd->req.cmd->common.dptr.sgl;
u32 len = le32_to_cpu(sgl->length);

- if (!cmd->req.data_len)
+ if (!len)
return 0;

if (sgl->type == ((NVME_SGL_FMT_DATA_DESC << 4) |
--
2.20.1