Commit c39eb080 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

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: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394088


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 97cbd304
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -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;