[PATCH] net/ixgbe: fix integer overflow in n-tuple filter mask

Ciara Loftus ciara.loftus at intel.com
Mon Nov 16 12:14:50 CET 2026


The uint8_t 5-tuple mask is promoted to a signed int before being
shifted by IXGBE_FTQF_5TUPLE_MASK_SHIFT (25). The result does not fit in
32 bits, which is undefined behaviour for a signed type. In practice it is
harmless since the bit that is lost does not contain any useful
information. Regardless it should be fixed instead of relying on the
undefined behaviour.

Fix it by casting the mask to uint32_t before the shift. For an unsigned
type the result keeps only the low 32 bits, so the programmed value is
unchanged.

Coverity issue: 507466

Fixes: 76db0ac63987 ("ixgbe: add filters")
Cc: stable at dpdk.org

Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 7592031217..c81802c04c 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -6413,7 +6413,7 @@ ixgbe_ntuple_filter_program(struct ixgbe_hw *hw, uint16_t index,
 		mask &= IXGBE_FTQF_DEST_PORT_MASK;
 	if (filter_info->proto_mask == 0)
 		mask &= IXGBE_FTQF_PROTOCOL_COMP_MASK;
-	ftqf |= mask << IXGBE_FTQF_5TUPLE_MASK_SHIFT;
+	ftqf |= (uint32_t)mask << IXGBE_FTQF_5TUPLE_MASK_SHIFT;
 	ftqf |= IXGBE_FTQF_POOL_MASK_EN;
 	ftqf |= IXGBE_FTQF_QUEUE_ENABLE;
 
-- 
2.43.0



More information about the dev mailing list