From: Fan Zhang Date: Fri, 27 Apr 2018 14:06:08 +0000 (+0100) Subject: vhost/crypto: fix checks while moving descriptors X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=613e827fb28687a990428dab4f34b41c1f180462;p=dpdk.git vhost/crypto: fix checks while moving descriptors This patch fix final condition check while moving virtqueue descriptors. Fixes: 3bb595ecd682 ("vhost/crypto: add request handler") Signed-off-by: Fan Zhang Reviewed-by: Maxime Coquelin --- diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index 620a1df3dc..7396ddd1ef 100644 --- a/lib/librte_vhost/vhost_crypto.c +++ b/lib/librte_vhost/vhost_crypto.c @@ -506,7 +506,7 @@ move_desc(struct vring_desc *head, struct vring_desc **cur_desc, left -= desc->len; } - if (unlikely(left < 0)) { + if (unlikely(left > 0)) { VC_LOG_ERR("Incorrect virtio descriptor"); return -1; } @@ -553,7 +553,7 @@ copy_data(void *dst_data, struct vring_desc *head, struct rte_vhost_memory *mem, left -= to_copy; } - if (unlikely(left < 0)) { + if (unlikely(left > 0)) { VC_LOG_ERR("Incorrect virtio descriptor"); return -1; }