From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fan Zhang Subject: [PATCH] vhost/crypto: fix condition check Date: Fri, 27 Apr 2018 15:06:08 +0100 Message-ID: <20180427140608.56661-1-roy.fan.zhang@intel.com> Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com, ferruh.yigit@intel.com To: dev@dpdk.org Return-path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 9EADF728E for ; Fri, 27 Apr 2018 16:13:30 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixes: 3bb595ecd682 ("vhost/crypto: add request handler") This patch fix final condition check while moving virtqueue descriptors. Signed-off-by: Fan Zhang --- lib/librte_vhost/vhost_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c index c38eb3bb5..4126c3bc1 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; } -- 2.13.6