patch 'net/nfp: fix shifts in BAR size calculation' has been queued to stable release 24.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Mon Jul 13 19:17:45 CEST 2026


Hi,

FYI, your patch has been queued to stable release 24.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/15/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/8417c1daffec99f0ac08fff7413281c6a1e541b4

Thanks.

Luca Boccassi

---
>From 8417c1daffec99f0ac08fff7413281c6a1e541b4 Mon Sep 17 00:00:00 2001
From: Alexey Simakov <bigalex934 at gmail.com>
Date: Tue, 7 Jul 2026 17:01:11 +0300
Subject: [PATCH] net/nfp: fix shifts in BAR size calculation

[ upstream commit 82fc03073c1b899290fd03cced628939e22117ad ]

The literal '1' is a signed 32-bit int. Shifting it by bar->bitsize
is undefined behavior when bitsize >= 31, and sign-extends when
bitsize == 31 (producing a wrong upper-bound check). BAR aperture
sizes from hardware can exceed this range.

Fix by using RTE_BIT64() which produces a 64-bit unsigned value,
matching the type of the operands (uint64_t base, uint64_t offset).

Fixes: c7e9729da6b5 ("net/nfp: support CPP")
Fixes: 1fbe51cd9c3a ("net/nfp: extend usage of BAR from 8 to 24")

Signed-off-by: Alexey Simakov <bigalex934 at gmail.com>
---
 drivers/net/nfp/nfpcore/nfp6000_pcie.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp6000_pcie.c b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
index 4693577f4e..f1360af1f7 100644
--- a/drivers/net/nfp/nfpcore/nfp6000_pcie.c
+++ b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
@@ -55,11 +55,11 @@
  */
 #define NFP_PCI_MIN_MAP_SIZE        0x080000        /* 512K */
 
-#define NFP_PCIE_P2C_FIXED_SIZE(bar)               (1 << (bar)->bitsize)
-#define NFP_PCIE_P2C_BULK_SIZE(bar)                (1 << (bar)->bitsize)
+#define NFP_PCIE_P2C_FIXED_SIZE(bar)               RTE_BIT64((bar)->bitsize)
+#define NFP_PCIE_P2C_BULK_SIZE(bar)                RTE_BIT64((bar)->bitsize)
 #define NFP_PCIE_P2C_GENERAL_TARGET_OFFSET(bar, x) ((x) << ((bar)->bitsize - 2))
 #define NFP_PCIE_P2C_GENERAL_TOKEN_OFFSET(bar, x) ((x) << ((bar)->bitsize - 4))
-#define NFP_PCIE_P2C_GENERAL_SIZE(bar)             (1 << ((bar)->bitsize - 4))
+#define NFP_PCIE_P2C_GENERAL_SIZE(bar)             RTE_BIT64(((bar)->bitsize - 4))
 
 #define NFP_PCIE_P2C_EXPBAR_OFFSET(bar_index)      ((bar_index) * 4)
 
@@ -443,7 +443,7 @@ matching_bar_exist(struct nfp_bar *bar,
 			(bar_token < 0 || bar_token == token) &&
 			bar_action == action &&
 			bar->base <= offset &&
-			(bar->base + (1 << bar->bitsize)) >= (offset + size))
+			(bar->base + RTE_BIT64(bar->bitsize)) >= (offset + size))
 		return true;
 
 	/* No match */
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-13 18:17:05.793628006 +0100
+++ 0005-net-nfp-fix-shifts-in-BAR-size-calculation.patch	2026-07-13 18:17:05.574282834 +0100
@@ -1 +1 @@
-From 82fc03073c1b899290fd03cced628939e22117ad Mon Sep 17 00:00:00 2001
+From 8417c1daffec99f0ac08fff7413281c6a1e541b4 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 82fc03073c1b899290fd03cced628939e22117ad ]
+
@@ -16 +17,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index 83b7116097..e03c4776d0 100644
+index 4693577f4e..f1360af1f7 100644


More information about the stable mailing list