[dpdk-dev] [PATCH] ixgbe: fix bad shift operation in ixgbe_set_pool_tx

Tomasz Kulasek tomaszx.kulasek at intel.com
Fri Apr 15 16:32:59 CEST 2016


CID 13190 (#1 of 1): Bad bit shift operation (BAD_SHIFT)
large_shift: In expression 1 << pool, left shifting by more than 31 bits
has undefined behavior. The shift amount, pool, is at least 32.

This patch limits mask shift to be in range of 32 bit PFVFTE[1] register,
for pool > 31.

Fixes: fe3a45fd4104 ("ixgbe: add VMDq support")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek at intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f676a64..6ae82e7 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4428,7 +4428,7 @@ ixgbe_set_pool_tx(struct rte_eth_dev *dev, uint16_t pool, uint8_t on)
 
 	addr = IXGBE_VFTE(pool >= ETH_64_POOLS/2);
 	reg = IXGBE_READ_REG(hw, addr);
-	val = bit1 << pool;
+	val = bit1 << (pool & 0x01F);
 
 	if (on)
 		reg |= val;
-- 
1.7.9.5



More information about the dev mailing list