|SUCCESS| bus/fslmc: fix shadowed variables in queue storage macros

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Wed Apr 8 12:01:39 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/162941

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-08

commit 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
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; \
>  	\
> -	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, \

Does this macro properly check the return value from rte_zmalloc() before
using q_storage[qs_idx]?  While the NULL check follows, if the allocation
fails partway through the loop, does this code leak the previously
allocated q_storage[] entries?  In the error path, dpaa2_queue_storage_free()
is never called by this macro itself.

[ ... ]

> -	ret; \
> +	qs_ret; \
>  })
>  
>  #define dpaa2_queue_storage_free(q, num) \
>  ({ \
>  	if (q) { \
> -		int i; \
> +		int qs_idx; \

Does this macro need the outer if (q) check?  The macro dereferences (q)
unconditionally in the for loop accessing (q)->q_storage[qs_idx].  If q
is NULL, does this crash?

[ ... ]


More information about the test-report mailing list