From 2fbada91545c004f04449500af0c6276900317ab Mon Sep 17 00:00:00 2001 From: David Marchand Date: Wed, 22 Jun 2022 17:30:20 +0200 Subject: [PATCH] vhost/crypto: fix descriptor processing copy_data was returning a pointer to an increased (off by one) descriptor. Subsequent calls to copy_data in the library were then failing. Fix this by incrementing the descriptor only if there is some left data to copy. Fixes: 4414bb67010d ("vhost/crypto: fix build with GCC 12") Cc: stable@dpdk.org Reported-by: Jakub Poczatek Signed-off-by: David Marchand Reviewed-by: Maxime Coquelin Tested-by: Jakub Poczatek Acked-by: Fan Zhang --- lib/vhost/vhost_crypto.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c index 96ffb82a5d..54946f46d9 100644 --- a/lib/vhost/vhost_crypto.c +++ b/lib/vhost/vhost_crypto.c @@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req *vc_req, return -1; left -= copied; data = RTE_PTR_ADD(data, copied); - desc++; - } while (desc < head + max_n_descs && left != 0); + } while (left != 0 && ++desc < head + max_n_descs); if (unlikely(left != 0)) return -1; -- 2.39.5