[PATCH 3/5] common/nfp: fix integer handling issues

Chaoyong He chaoyong.he at corigine.com
Wed Nov 15 04:23:08 CET 2023


CI found integer handling issues, overflow before widen.

Coverity issue: 405351
Fixes: 87f5b35ba4e8 ("common/nfp: move queue logic")
Cc: stable at dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
 drivers/common/nfp/nfp_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/common/nfp/nfp_common.c b/drivers/common/nfp/nfp_common.c
index 4c94c9d59a..40e1620c2e 100644
--- a/drivers/common/nfp/nfp_common.c
+++ b/drivers/common/nfp/nfp_common.c
@@ -187,14 +187,14 @@ nfp_enable_queues(struct nfp_hw *hw,
 	/* Enabling the required TX queues in the device */
 	enabled_queues = 0;
 	for (i = 0; i < nb_tx_queues; i++)
-		enabled_queues |= (1 << i);
+		enabled_queues |= (1ULL << i);
 
 	nn_cfg_writeq(hw, NFP_NET_CFG_TXRS_ENABLE, enabled_queues);
 
 	/* Enabling the required RX queues in the device */
 	enabled_queues = 0;
 	for (i = 0; i < nb_rx_queues; i++)
-		enabled_queues |= (1 << i);
+		enabled_queues |= (1ULL << i);
 
 	nn_cfg_writeq(hw, NFP_NET_CFG_RXRS_ENABLE, enabled_queues);
 }
-- 
2.39.1



More information about the stable mailing list