DPDK patches and discussions
 help / color / mirror / Atom feed
From: Fan Zhang <roy.fan.zhang@intel.com>
To: dev@dpdk.org
Cc: roy.fan.zhang@intel.com, maxime.coquelin@redhat.com,
	ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH] vhost/crypto: fix condition check
Date: Fri, 27 Apr 2018 15:06:08 +0100	[thread overview]
Message-ID: <20180427140608.56661-1-roy.fan.zhang@intel.com> (raw)

Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")

This patch fix final condition check while moving virtqueue
descriptors.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 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

             reply	other threads:[~2018-04-27 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 14:06 Fan Zhang [this message]
2018-04-27 14:21 ` Maxime Coquelin
2018-04-27 17:43   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180427140608.56661-1-roy.fan.zhang@intel.com \
    --to=roy.fan.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=maxime.coquelin@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).