raw/ifpga: add Intel FPGA bus rawdev driver
[dpdk.git] / lib / librte_vhost / vhost_crypto.c
index c38eb3b..7396ddd 100644 (file)
@@ -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;
        }
@@ -919,6 +919,7 @@ vhost_crypto_process_one_req(struct vhost_crypto *vcrypto,
                if (unlikely(!desc || dlen != head->len))
                        return -1;
                desc_idx = 0;
+               head = desc;
        } else {
                desc = head;
        }
@@ -1189,8 +1190,8 @@ rte_vhost_crypto_set_zero_copy(int vid, enum rte_vhost_crypto_zero_copy option)
                return -EINVAL;
        }
 
-       if (unlikely(option < 0 || option >=
-                       RTE_VHOST_CRYPTO_MAX_ZERO_COPY_OPTIONS)) {
+       if (unlikely((uint32_t)option >=
+                               RTE_VHOST_CRYPTO_MAX_ZERO_COPY_OPTIONS)) {
                VC_LOG_ERR("Invalid option %i", option);
                return -EINVAL;
        }