From c39eb080b3792c74dc8ec2565fb9f6fd5716f759 Mon Sep 17 00:00:00 2001 From: Dariusz Stojaczyk Date: Tue, 9 Jan 2018 18:53:17 +0100 Subject: [PATCH] vhost_scsi: removed duplicated check against VHOST_IOVS_MAX The same check is done inside spdk_vhost_vring_desc_to_iov. Change-Id: Id93a05848ed69b8dd048ac490df2432b4252c6e0 Signed-off-by: Dariusz Stojaczyk Reviewed-on: https://review.gerrithub.io/394088 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/vhost/vhost_scsi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/vhost/vhost_scsi.c b/lib/vhost/vhost_scsi.c index 38fb20e37..4c0885492 100644 --- a/lib/vhost/vhost_scsi.c +++ b/lib/vhost/vhost_scsi.c @@ -398,7 +398,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task, struct spdk_vhost_dev *vdev = &task->svdev->vdev; struct vring_desc *desc, *desc_table; struct iovec *iovs = task->iovs; - uint16_t iovcnt = 0, iovcnt_max = SPDK_VHOST_IOVS_MAX; + uint16_t iovcnt = 0; uint32_t desc_table_len, len = 0; int rc; @@ -463,7 +463,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task, } /* All remaining descriptors are data. */ - while (desc && iovcnt < iovcnt_max) { + while (desc) { if (spdk_unlikely(!spdk_vhost_vring_desc_is_wr(desc))) { SPDK_WARNLOG("FROM DEV cmd: descriptor nr %" PRIu16" in payload chain is read only.\n", iovcnt); goto invalid_task; @@ -489,7 +489,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task, */ /* Process descriptors up to response. */ - while (!spdk_vhost_vring_desc_is_wr(desc) && iovcnt < iovcnt_max) { + while (!spdk_vhost_vring_desc_is_wr(desc)) { if (spdk_unlikely(spdk_vhost_vring_desc_to_iov(vdev, iovs, &iovcnt, desc))) { goto invalid_task; } @@ -510,12 +510,6 @@ task_data_setup(struct spdk_vhost_scsi_task *task, } } - if (iovcnt == iovcnt_max) { - SPDK_WARNLOG("Too many IO vectors in chain!\n"); - task->resp->response = VIRTIO_SCSI_S_ABORTED; - goto invalid_task; - } - task->scsi.iovcnt = iovcnt; task->scsi.length = len; task->scsi.transfer_len = len;