crypto/virtio: fix IV offset
authorFan Zhang <roy.fan.zhang@intel.com>
Fri, 5 Apr 2019 16:04:24 +0000 (17:04 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 19 Apr 2019 12:51:54 +0000 (14:51 +0200)
This patch fixes the incorrect iv offset calculation.

Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/crypto/virtio/virtio_rxtx.c

index e32a1ec..e9a63cb 100644 (file)
@@ -203,8 +203,8 @@ virtqueue_crypto_sym_enqueue_xmit(
        uint16_t req_data_len = sizeof(struct virtio_crypto_op_data_req);
        uint32_t indirect_vring_addr_offset = req_data_len +
                sizeof(struct virtio_crypto_inhdr);
-       uint32_t indirect_iv_addr_offset = indirect_vring_addr_offset +
-                       sizeof(struct vring_desc) * NUM_ENTRY_VIRTIO_CRYPTO_OP;
+       uint32_t indirect_iv_addr_offset =
+                       offsetof(struct virtio_crypto_op_cookie, iv);
        struct rte_crypto_sym_op *sym_op = cop->sym;
        struct virtio_crypto_session *session =
                (struct virtio_crypto_session *)get_sym_session_private_data(