patch 'net/bnxt/tf_ulp: enforce bounds in bitstream extraction' has been queued to stable release 25.11.5
Kevin Traynor
ktraynor at redhat.com
Thu Dec 3 14:02:14 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/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/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/c29e3e8b558d454f510399a4ce0c1ef3c3416c75
Thanks.
Kevin
---
>From c29e3e8b558d454f510399a4ce0c1ef3c3416c75 Mon Sep 17 00:00:00 2001
From: Joey Zhong <xiaozhen.zhong at broadcom.com>
Date: Mon, 5 Oct 2026 15:25:26 -0500
Subject: [PATCH] net/bnxt/tf_ulp: enforce bounds in bitstream extraction
[ upstream commit dcd7cc960b8ab5cc6b1b0b8d7392606dee5548ca ]
GCC inlines ulp_bs_pull_lsb() and flags the remainder branch:
if (len)
ulp_bs_get_lsb(src, offset, len, &dst[size - 1 - idx]);
After the full-byte loop exits, idx == cnt. When cnt == size with a
non-zero bit remainder (e.g., len = 33 with size = 4), the subscript
size - 1 - idx underflows to UINT32_MAX, producing a -Warray-bounds
false positive (and a genuine out-of-bounds write if len/size are
ever miscalculated upstream of the check that normally prevents
this). ulp_blob_pull() rejects this state via its
ULP_BYTE_2_BITS(data_size) < len check, but GCC cannot carry that
constraint through the inlined call chain.
Changes:
- ulp_bs_pull_lsb / ulp_bs_pull_msb: add unlikely(cnt > size) entry
guard and an explicit likely(idx < size) check on the remainder
branch so GCC can prove all subscripts are in range.
- ulp_bs_pull_msb: add the missing uint32_t size parameter (matching
ulp_bs_pull_lsb) and update its three call sites to pass the
destination buffer size.
- ulp_bs_get_lsb / ulp_bs_get_msb: add unlikely(!bitlen) early exit
to make the zero-length contract explicit.
Fixes: f634204b7ad8 ("net/bnxt: support generic table processing")
Signed-off-by: Joey Zhong <xiaozhen.zhong at broadcom.com>
Signed-off-by: Manish Kurup <manish.kurup at broadcom.com>
---
.mailmap | 1 +
drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c | 2 +-
drivers/net/bnxt/tf_ulp/ulp_mapper.c | 1 +
drivers/net/bnxt/tf_ulp/ulp_utils.h | 44 +++++++++++++++++++++++----
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/.mailmap b/.mailmap
index 2c200b70d6..8d5c1268c3 100644
--- a/.mailmap
+++ b/.mailmap
@@ -785,4 +785,5 @@ Jochen Behrens <jochen.behrens at broadcom.com> <jbehrens at vmware.com>
Joel Kavanagh <joel.kavanagh at intel.com>
Joey Xing <joey.xing at jaguarmicro.com>
+Joey Zhong <xiaozhen.zhong at broadcom.com>
Johan Faltstrom <johan.faltstrom at netinsight.net>
Johan Källström <johan.kallstrom at ericsson.com>
diff --git a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
index ac0a7e6db1..535849b1f9 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_gen_tbl.c
@@ -310,5 +310,5 @@ ulp_mapper_gen_tbl_entry_data_get(struct ulp_mapper_gen_tbl_entry *entry,
ulp_bs_pull_lsb(entry->byte_data, data, data_size, offset, len);
else
- ulp_bs_pull_msb(entry->byte_data, data, offset, len);
+ ulp_bs_pull_msb(entry->byte_data, data, data_size, offset, len);
return 0;
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 960cdda311..168f05a5a4 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -702,4 +702,5 @@ ulp_mapper_tbl_ident_scan_ext(struct bnxt_ulp_mapper_parms *parms,
else
ulp_bs_pull_msb(byte_data, (uint8_t *)&val64,
+ sizeof(val64),
idents[i].ident_bit_pos,
idents[i].ident_bit_size);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h
index ce20f1916f..5cb6e48b37 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_utils.h
+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.h
@@ -664,4 +664,9 @@ ulp_bs_get_lsb(uint8_t *src, uint16_t bitpos, uint8_t bitlen, uint8_t *dst)
uint8_t mask, partial, shift;
+ if (unlikely(!bitlen)) {
+ *dst = 0;
+ return;
+ }
+
shift = bitoffs;
partial = ULP_BLOB_BYTE - bitoffs;
@@ -701,4 +706,14 @@ ulp_bs_pull_lsb(uint8_t *src, uint8_t *dst, uint32_t size,
uint32_t cnt = ULP_BITS_2_BYTE_NR(len);
+ /*
+ * cnt > size means len >= (size + 1) * 8; caller should have
+ * rejected this. It does not catch size*8 < len < (size + 1)*8,
+ * which also can't fit in dst: there cnt == size, so idx == size
+ * after the loop below, which makes "idx < size" false and
+ * silently drops the remainder instead of writing past dst.
+ */
+ if (unlikely(cnt > size))
+ return;
+
/* iterate bytewise to get data */
for (idx = 0; idx < cnt; idx++) {
@@ -709,6 +724,6 @@ ulp_bs_pull_lsb(uint8_t *src, uint8_t *dst, uint32_t size,
}
- /* Extract the last reminder data that is not 8 byte boundary */
- if (len)
+ /* Extract the last remainder data that is not 8 byte boundary */
+ if (len && likely(idx < size))
ulp_bs_get_lsb(src, offset, len, &dst[size - 1 - idx]);
}
@@ -736,4 +751,9 @@ ulp_bs_get_msb(uint8_t *src, uint16_t bitpos, uint8_t bitlen, uint8_t *dst)
int32_t shift;
+ if (unlikely(!bitlen)) {
+ *dst = 0;
+ return;
+ }
+
shift = ULP_BLOB_BYTE - bitoffs - bitlen;
if (shift >= 0) {
@@ -753,4 +773,6 @@ ulp_bs_get_msb(uint8_t *src, uint16_t bitpos, uint8_t bitlen, uint8_t *dst)
* dst [out] The byte array where data is pulled into
*
+ * size [in] The size of dst array in bytes
+ *
* offset [in] The offset where data is pulled
*
@@ -760,5 +782,5 @@ ulp_bs_get_msb(uint8_t *src, uint16_t bitpos, uint8_t bitlen, uint8_t *dst)
*/
static inline void
-ulp_bs_pull_msb(uint8_t *src, uint8_t *dst,
+ulp_bs_pull_msb(uint8_t *src, uint8_t *dst, uint32_t size,
uint32_t offset, uint32_t len)
{
@@ -766,4 +788,14 @@ ulp_bs_pull_msb(uint8_t *src, uint8_t *dst,
uint32_t cnt = ULP_BITS_2_BYTE_NR(len);
+ /*
+ * cnt > size means len >= (size + 1) * 8; caller should have
+ * rejected this. It does not catch size*8 < len < (size + 1)*8,
+ * which also can't fit in dst: there cnt == size, so idx == size
+ * after the loop below, which makes "idx < size" false and
+ * silently drops the remainder instead of writing past dst.
+ */
+ if (unlikely(cnt > size))
+ return;
+
/* iterate bytewise to get data */
for (idx = 0; idx < cnt; idx++) {
@@ -773,6 +805,6 @@ ulp_bs_pull_msb(uint8_t *src, uint8_t *dst,
}
- /* Extract the last reminder data that is not 8 byte boundary */
- if (len)
+ /* Extract the last remainder data that is not 8 byte boundary */
+ if (len && likely(idx < size))
ulp_bs_get_msb(src, offset, len, &dst[idx]);
}
@@ -803,5 +835,5 @@ ulp_blob_pull(struct ulp_blob *blob, uint8_t *data, uint32_t data_size,
if (blob->byte_order == BNXT_ULP_BYTE_ORDER_BE)
- ulp_bs_pull_msb(blob->data, data, offset, len);
+ ulp_bs_pull_msb(blob->data, data, data_size, offset, len);
else
ulp_bs_pull_lsb(blob->data, data, data_size, offset, len);
--
2.56.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-12-03 12:52:45.182074351 +0000
+++ 0208-net-bnxt-tf_ulp-enforce-bounds-in-bitstream-extracti.patch 2026-12-03 12:52:39.184938698 +0000
@@ -1 +1 @@
-From dcd7cc960b8ab5cc6b1b0b8d7392606dee5548ca Mon Sep 17 00:00:00 2001
+From c29e3e8b558d454f510399a4ce0c1ef3c3416c75 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit dcd7cc960b8ab5cc6b1b0b8d7392606dee5548ca ]
+
@@ -29 +30,0 @@
-Cc: stable at dpdk.org
@@ -41 +42 @@
-index b2fe3166d6..6b81952a55 100644
+index 2c200b70d6..8d5c1268c3 100644
@@ -44 +45 @@
-@@ -793,4 +793,5 @@ Jochen Behrens <jochen.behrens at broadcom.com> <jbehrens at vmware.com>
+@@ -785,4 +785,5 @@ Jochen Behrens <jochen.behrens at broadcom.com> <jbehrens at vmware.com>
More information about the stable
mailing list