[PATCH 2/2] crypto/ionic: fix sign extension in queue allocation

Andrew Boyer andrew.boyer at amd.com
Mon Jul 1 17:22:50 CEST 2024


(uint16_t * uint16_t) promoted to uint64_t has a sign extension
problem reported by Coverity. Cast one arg to uint64_t first
to eliminate the sign extension.

Coverity issue: 426422
Coverity issue: 426427
Fixes: 2c1662bb53ca ("crypto/ionic: add adminq command")

Signed-off-by: Andrew Boyer <andrew.boyer at amd.com>
---
 drivers/crypto/ionic/ionic_crypto_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ionic/ionic_crypto_main.c b/drivers/crypto/ionic/ionic_crypto_main.c
index 9960dc3a6d..f670d6e658 100644
--- a/drivers/crypto/ionic/ionic_crypto_main.c
+++ b/drivers/crypto/ionic/ionic_crypto_main.c
@@ -88,7 +88,7 @@ iocpt_q_init(struct iocpt_queue *q, uint8_t type, uint32_t index,
 	q->tail_idx = 0;
 
 	q->info = rte_calloc_socket("iocpt",
-				num_descs * num_segs, sizeof(void *),
+				(uint64_t)num_descs * num_segs, sizeof(void *),
 				rte_mem_page_size(), socket_id);
 	if (q->info == NULL) {
 		IOCPT_PRINT(ERR, "Cannot allocate queue info");
-- 
2.17.1



More information about the dev mailing list