[PATCH dpdk v2] ring: assert wraparound enqueue stays within input
Robin Jarry
rjarry at redhat.com
Tue Dec 1 10:00:35 CET 2026
GCC 13 at -O2 reports -Wmaybe-uninitialized for a fully initialized
24-byte item passed to rte_ring_enqueue_elem(). The acquire fence
introduced by commit f2f3cf6d098a ("ring: replace SMP barrier with
acquire fence") exposes GCC's inability to infer that a valid wrap
consumes fewer than n input words before restarting.
State that invariant with __rte_assume() inside the wrap loop instead of
adding a condition to the loop.
Fixes: f2f3cf6d098a ("ring: replace SMP barrier with acquire fence")
Cc: stable at dpdk.org
Signed-off-by: Robin Jarry <rjarry at redhat.com>
---
Notes:
v2: replaced loop condition with __rte_assume()
lib/ring/rte_ring_elem_pvt.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h
index 3d680749ad96..77a2efafe119 100644
--- a/lib/ring/rte_ring_elem_pvt.h
+++ b/lib/ring/rte_ring_elem_pvt.h
@@ -47,8 +47,10 @@ __rte_ring_enqueue_elems_32(void *ring_table, const void *obj_table,
ring[idx++] = obj[i++]; /* fallthrough */
}
} else {
- for (i = 0; idx < size; i++, idx++)
+ for (i = 0; idx < size; i++, idx++) {
+ __rte_assume(i < n);
ring[idx] = obj[i];
+ }
/* Start at the beginning */
for (idx = 0; i < n; i++, idx++)
ring[idx] = obj[i];
--
2.56.1
More information about the stable
mailing list