[PATCH 01/12] net/xsc: avoid integer overflow

Renyong Wan wanry at yunsilicon.com
Sat Feb 22 04:57:33 CET 2025


Address the integer overflow issue reported by Coverity Scan.

Coverity issue: 456589

Signed-off-by: Renyong Wan <wanry at yunsilicon.com>
---
 drivers/net/xsc/xsc_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xsc/xsc_tx.c b/drivers/net/xsc/xsc_tx.c
index 406fa95381..1d31e84d69 100644
--- a/drivers/net/xsc/xsc_tx.c
+++ b/drivers/net/xsc/xsc_tx.c
@@ -50,7 +50,7 @@ xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
 	txq_data->cq_db = cq_info.cq_db;
 	txq_data->cqn = cq_info.cqn;
 	txq_data->cqes = cq_info.cqes;
-	txq_data->cqe_m = txq_data->cqe_s - 1;
+	txq_data->cqe_m = (uint16_t)(1 << cq_info.cqe_n) - 1;
 
 	PMD_DRV_LOG(INFO, "Create tx cq, cqe_s:%d, cqe_n:%d, cq_db=%p, cqn:%d",
 		    txq_data->cqe_s, txq_data->cqe_n,
-- 
2.25.1


More information about the dev mailing list