DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ciara Loftus <ciara.loftus@intel.com>
To: dev@dpdk.org
Cc: Ciara Loftus <ciara.loftus@intel.com>, stable@dpdk.org
Subject: [PATCH] net/ixgbe: fix integer overflow in n-tuple filter mask
Date: Mon, 16 Nov 2026 11:14:50 +0000	[thread overview]
Message-ID: <20261116111450.9700-1-ciara.loftus@intel.com> (raw)

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


                 reply	other threads:[~2026-11-16 11:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116111450.9700-1-ciara.loftus@intel.com \
    --to=ciara.loftus@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox