nvmf: fix check for buffs num in nvmf_request_get_buffers

There is no need to sum SPDK_CEIL_DIV(length, io_unit_size) and
req->iovcnt as the later is always zero (assignment in spdk_nvmf_request_get_buffers).
Checking SPDK_CEIL_DIV(length, io_unit_size) is enough.

Signed-off-by: Maciej Szulik <maciej.szulik@intel.com>
Change-Id: I0fea1d86706d83e4dd9083e6f0ce09e4e4b033a8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10089
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Maciej Szulik 2021-11-02 11:31:12 -04:00 committed by Jim Harris
parent d83b2ee4f4
commit 864580073f

View File

@ -699,7 +699,7 @@ nvmf_request_get_buffers(struct spdk_nvmf_request *req,
* Fail it.
*/
num_buffers = SPDK_CEIL_DIV(length, io_unit_size);
if (num_buffers + req->iovcnt > NVMF_REQ_MAX_BUFFERS) {
if (num_buffers > NVMF_REQ_MAX_BUFFERS) {
return -EINVAL;
}