Coverity flags an untrusted loop bound. Check length of session iv.
Coverity issue: 375802
Fixes: b063e843fa03 ("crypto/virtio: fix IV physical address")
Cc: stable@dpdk.org
Signed-off-by: Brian Dooley <brian.dooley@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
if (cop->phys_addr)
desc[idx].addr = cop->phys_addr + session->iv.offset;
else {
+ if (session->iv.length > VIRTIO_CRYPTO_MAX_IV_SIZE)
+ return -ENOMEM;
+
rte_memcpy(crypto_op_cookie->iv,
rte_crypto_op_ctod_offset(cop,
uint8_t *, session->iv.offset),