|SUCCESS| bus/fslmc: fix shadowed variables in queue storage macros
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Apr 7 13:20:24 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162886
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-07
commit bbeccd8fc300c0da2a5e7df15ab4c3f4a9fb4289
Author: Weijun Pan <wpan36 at wisc.edu>
bus/fslmc: fix shadowed variables in queue storage macros
The queue storage allocation and free macros declare local variables
named ret and i, which shadow local variables in
rte_dpaa2_create_dpci_device() and trigger -Wshadow warnings.
Rename the macro-local variables to avoid shadowing without changing
behavior.
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> index e625a5c035..bbeccd8fc3 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
> @@ -204,33 +204,33 @@ struct swp_active_dqs {
>
> #define dpaa2_queue_storage_alloc(q, num) \
> ({ \
> - int ret = 0, i; \
> + int qs_ret = 0, qs_idx; \
This macro uses a statement expression construct, is this compatible
with C99 and C11 standards that DPDK supports? Although GCC and clang
support statement expressions as an extension, the coding style guide
emphasizes portable C code.
> [ ... ]
> @@ -204,33 +204,33 @@ struct swp_active_dqs {
> #define dpaa2_queue_storage_alloc(q, num) \
> ({ \
> - int ret = 0, i; \
> + int qs_ret = 0, qs_idx; \
> \
> - for (i = 0; i < (num); i++) { \
> - (q)->q_storage[i] = rte_zmalloc(NULL, \
> + for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
> + (q)->q_storage[qs_idx] = rte_zmalloc(NULL, \
> sizeof(struct queue_storage_info_t), \
> RTE_CACHE_LINE_SIZE); \
> - if (!(q)->q_storage[i]) { \
> - ret = -ENOBUFS; \
> + if (!(q)->q_storage[qs_idx]) { \
> + qs_ret = -ENOBUFS; \
When rte_zmalloc() fails here, does this code leak previously allocated
q_storage[0..qs_idx-1]? The loop breaks without freeing already
allocated storage entries.
Similarly, when dpaa2_alloc_dq_storage() fails below, does this leak
both the q_storage[qs_idx] allocated from rte_zmalloc() and any
q_storage[0..qs_idx-1] allocated in prior iterations?
> break; \
> } \
> - ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
> - if (ret) \
> + qs_ret = dpaa2_alloc_dq_storage((q)->q_storage[qs_idx]); \
> + if (qs_ret) \
> break; \
> } \
> - ret; \
> + qs_ret; \
> })
More information about the test-report
mailing list