* [PATCH] net/ixgbe: fix integer overflow in n-tuple filter mask
@ 2026-11-16 11:14 Ciara Loftus
0 siblings, 0 replies; only message in thread
From: Ciara Loftus @ 2026-11-16 11:14 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus, stable
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@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-16 11:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 11:14 [PATCH] net/ixgbe: fix integer overflow in n-tuple filter mask Ciara Loftus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox