From patchwork Fri Apr 27 14:06:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fan Zhang X-Patchwork-Id: 39110 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C9E487CD1; Fri, 27 Apr 2018 16:13:31 +0200 (CEST) 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) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2018 07:13:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,335,1520924400"; d="scan'208";a="51330591" Received: from silpixa00398673.ir.intel.com (HELO silpixa00398673.ger.corp.intel.com) ([10.237.223.54]) by orsmga001.jf.intel.com with ESMTP; 27 Apr 2018 07:13:28 -0700 From: Fan Zhang To: dev@dpdk.org Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com, ferruh.yigit@intel.com Date: Fri, 27 Apr 2018 15:06:08 +0100 Message-Id: <20180427140608.56661-1-roy.fan.zhang@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] vhost/crypto: fix condition check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 Reviewed-by: Maxime Coquelin --- 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; }