Return value on error changed from '-1' to '0' because it returns
unsigned value and it means number of used descriptors.
Also fixed updating of 'last_used_idx' by using actual number of
used descriptors.
Fixes:
623bc47054d0 ("vhost: do sanity check for ring descriptor length")
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
dev->vid, cur_idx, end_idx);
if (buf_vec[vec_idx].buf_len < dev->vhost_hlen)
- return -1;
+ return 0;
desc_addr = gpa_to_vva(dev, buf_vec[vec_idx].buf_addr);
rte_prefetch0((void *)(uintptr_t)desc_addr);
*(volatile uint16_t *)&vq->used->idx += nr_used;
vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
sizeof(vq->used->idx));
- vq->last_used_idx = end;
+ vq->last_used_idx += nr_used;
}
if (likely(pkt_idx)) {