cryptodev: fix multi-segment raw vector processing

If no next segment available the “for” loop will fail and it still
returns i+1 i.e. 2, which is wrong as it has filled only 1 buffer.

Fixes: 7adf992fb9bf ("cryptodev: introduce CPU crypto API")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
This commit is contained in:
Gagandeep Singh 2021-10-14 00:30:21 +05:30 committed by Akhil Goyal
parent 68f5d3d320
commit 8edcb68fd0

View File

@ -990,6 +990,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
/* whole requested data is completed */
vec[i].len = left;
left = 0;
i++;
break;
}
@ -999,7 +1000,7 @@ rte_crypto_mbuf_to_vec(const struct rte_mbuf *mb, uint32_t ofs, uint32_t len,
}
RTE_ASSERT(left == 0);
return i + 1;
return i;
}