From b2e778b27165f1425cde70567a956bc77a2cf216 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 9 Apr 2019 11:19:31 -0700 Subject: [PATCH] nvme_ns_cmd: fix bug in split_request_sgl The while loop in this function was structured such that if the final child request did not contain a full number of SGE elements, it would be truncated. We need to not only check whether we have a full number of SGEs, but also if the current child has consumed the end of the parent request. Change-Id: I7df6c224e9ab66033c92d2cf1af10452f5cdfd9b Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450684 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvme/nvme_ns_cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nvme/nvme_ns_cmd.c b/lib/nvme/nvme_ns_cmd.c index 567c8e8d3..da37552c5 100644 --- a/lib/nvme/nvme_ns_cmd.c +++ b/lib/nvme/nvme_ns_cmd.c @@ -382,7 +382,7 @@ _nvme_ns_cmd_split_request_sgl(struct spdk_nvme_ns *ns, req_current_length += sge_length; num_sges++; - if (num_sges < max_sges) { + if (num_sges < max_sges && req_current_length < req->payload_size) { continue; }