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 <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/394088 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
97cbd304db
commit
c39eb080b3
@ -398,7 +398,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task,
|
|||||||
struct spdk_vhost_dev *vdev = &task->svdev->vdev;
|
struct spdk_vhost_dev *vdev = &task->svdev->vdev;
|
||||||
struct vring_desc *desc, *desc_table;
|
struct vring_desc *desc, *desc_table;
|
||||||
struct iovec *iovs = task->iovs;
|
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;
|
uint32_t desc_table_len, len = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* All remaining descriptors are data. */
|
/* All remaining descriptors are data. */
|
||||||
while (desc && iovcnt < iovcnt_max) {
|
while (desc) {
|
||||||
if (spdk_unlikely(!spdk_vhost_vring_desc_is_wr(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);
|
SPDK_WARNLOG("FROM DEV cmd: descriptor nr %" PRIu16" in payload chain is read only.\n", iovcnt);
|
||||||
goto invalid_task;
|
goto invalid_task;
|
||||||
@ -489,7 +489,7 @@ task_data_setup(struct spdk_vhost_scsi_task *task,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Process descriptors up to response. */
|
/* 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))) {
|
if (spdk_unlikely(spdk_vhost_vring_desc_to_iov(vdev, iovs, &iovcnt, desc))) {
|
||||||
goto invalid_task;
|
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.iovcnt = iovcnt;
|
||||||
task->scsi.length = len;
|
task->scsi.length = len;
|
||||||
task->scsi.transfer_len = len;
|
task->scsi.transfer_len = len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user