From 8edcb68fd01b6a1e47549be389335cfef042ea05 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Thu, 14 Oct 2021 00:30:21 +0530 Subject: [PATCH] cryptodev: fix multi-segment raw vector processing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Acked-by: Konstantin Ananyev Acked-by: Akhil Goyal --- lib/cryptodev/rte_crypto_sym.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h index c907b1646d..daa090b978 100644 --- a/lib/cryptodev/rte_crypto_sym.h +++ b/lib/cryptodev/rte_crypto_sym.h @@ -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; } -- 2.20.1