patch 'eal: fix variable shadowing' has been queued to stable release 25.11.1
Kevin Traynor
ktraynor at redhat.com
Thu Feb 26 14:08:08 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/02/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/f9423a7e0083291f4e4892169b02e695d6a19673
Thanks.
Kevin
---
>From f9423a7e0083291f4e4892169b02e695d6a19673 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Wed, 14 Jan 2026 15:44:16 +0000
Subject: [PATCH] eal: fix variable shadowing
[ upstream commit 68c2dde1d441cda8e5656e46b018f7a39e47a669 ]
Fix a range of variable shadowing issues flagged by -Wshadow:
* In tracing code, rename local variables to remove shadowing in the
code. The file-level variable "trace" is kept as-is, but the shorter
name "t" is used for function-local vars.
* In options code, rename the "args" variable to "out_args" in the
telemetry callback, to fix shadowing issues there.
* In malloc code, remove the redefinition of aligned_end, and just use
the already-defined local variable in the last block of code in the
function.
Bugzilla ID: 1742
Bugzilla ID: 1743
Fixes: 29d985cad8db ("trace: implement memory allocation")
Fixes: f330b01df996 ("eal: define the parameters in argparse format")
Fixes: 4d8bdd8b56a1 ("malloc: fix ASan handling for unmapped memory")
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/eal/common/eal_common_options.c | 22 +++----
lib/eal/common/eal_common_trace.c | 90 ++++++++++++++---------------
lib/eal/common/malloc_heap.c | 2 +-
3 files changed, 56 insertions(+), 58 deletions(-)
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index b1fb670ea0..c53d10fd27 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -340,19 +340,19 @@ handle_eal_info_request(const char *cmd, const char *params __rte_unused,
struct rte_tel_data *d)
{
- char **args;
+ char **out_args;
int used = 0;
int i = 0;
if (strcmp(cmd, EAL_PARAM_REQ) == 0)
- args = eal_args;
+ out_args = eal_args;
else
- args = eal_app_args;
+ out_args = eal_app_args;
rte_tel_data_start_array(d, RTE_TEL_STRING_VAL);
- if (args == NULL || args[0] == NULL)
+ if (out_args == NULL || out_args[0] == NULL)
return 0;
- for ( ; args[i] != NULL; i++)
- used = rte_tel_data_add_array_string(d, args[i]);
+ for ( ; out_args[i] != NULL; i++)
+ used = rte_tel_data_add_array_string(d, out_args[i]);
return used;
}
@@ -430,12 +430,12 @@ eal_clean_saved_args(void)
static int
-eal_option_device_add(enum rte_devtype type, const char *optarg)
+eal_option_device_add(enum rte_devtype type, const char *arg)
{
struct device_option *devopt;
- size_t optlen;
+ size_t arglen;
int ret;
- optlen = strlen(optarg) + 1;
- devopt = calloc(1, sizeof(*devopt) + optlen);
+ arglen = strlen(arg) + 1;
+ devopt = calloc(1, sizeof(*devopt) + arglen);
if (devopt == NULL) {
EAL_LOG(ERR, "Unable to allocate device option");
@@ -444,5 +444,5 @@ eal_option_device_add(enum rte_devtype type, const char *optarg)
devopt->type = type;
- ret = strlcpy(devopt->arg, optarg, optlen);
+ ret = strlcpy(devopt->arg, arg, arglen);
if (ret < 0) {
EAL_LOG(ERR, "Unable to copy device option");
diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c
index be041c45bb..a76dff0017 100644
--- a/lib/eal/common/eal_common_trace.c
+++ b/lib/eal/common/eal_common_trace.c
@@ -271,23 +271,23 @@ static void
trace_lcore_mem_dump(FILE *f)
{
- struct trace *trace = trace_obj_get();
+ struct trace *t = trace_obj_get();
struct __rte_trace_header *header;
uint32_t count;
- rte_spinlock_lock(&trace->lock);
- if (trace->nb_trace_mem_list == 0)
+ rte_spinlock_lock(&t->lock);
+ if (t->nb_trace_mem_list == 0)
goto out;
- fprintf(f, "nb_trace_mem_list = %d\n", trace->nb_trace_mem_list);
+ fprintf(f, "nb_trace_mem_list = %d\n", t->nb_trace_mem_list);
fprintf(f, "\nTrace mem info\n--------------\n");
- for (count = 0; count < trace->nb_trace_mem_list; count++) {
- header = trace->lcore_meta[count].mem;
+ for (count = 0; count < t->nb_trace_mem_list; count++) {
+ header = t->lcore_meta[count].mem;
fprintf(f, "\tid %d, mem=%p, area=%s, lcore_id=%d, name=%s\n",
count, header,
- trace_area_to_string(trace->lcore_meta[count].area),
+ trace_area_to_string(t->lcore_meta[count].area),
header->stream_header.lcore_id,
header->stream_header.thread_name);
}
out:
- rte_spinlock_unlock(&trace->lock);
+ rte_spinlock_unlock(&t->lock);
}
@@ -296,6 +296,5 @@ void
rte_trace_dump(FILE *f)
{
- struct trace_point_head *tp_list = trace_list_head_get();
- struct trace *trace = trace_obj_get();
+ struct trace *t = trace_obj_get();
struct trace_point *tp;
@@ -305,11 +304,11 @@ rte_trace_dump(FILE *f)
fprintf(f, "mode = %s\n",
trace_mode_to_string(rte_trace_mode_get()));
- fprintf(f, "dir = %s\n", trace->dir);
- fprintf(f, "buffer len = %d\n", trace->buff_len);
- fprintf(f, "number of trace points = %d\n", trace->nb_trace_points);
+ fprintf(f, "dir = %s\n", t->dir);
+ fprintf(f, "buffer len = %d\n", t->buff_len);
+ fprintf(f, "number of trace points = %d\n", t->nb_trace_points);
trace_lcore_mem_dump(f);
fprintf(f, "\nTrace point info\n----------------\n");
- STAILQ_FOREACH(tp, tp_list, next)
+ STAILQ_FOREACH(tp, trace_list_head_get(), next)
trace_point_dump(f, tp);
}
@@ -332,5 +331,5 @@ void
__rte_trace_mem_per_thread_alloc(void)
{
- struct trace *trace = trace_obj_get();
+ struct trace *t = trace_obj_get();
struct __rte_trace_header *header;
uint32_t count;
@@ -342,14 +341,14 @@ __rte_trace_mem_per_thread_alloc(void)
return;
- rte_spinlock_lock(&trace->lock);
+ rte_spinlock_lock(&t->lock);
- count = trace->nb_trace_mem_list;
+ count = t->nb_trace_mem_list;
/* Allocate room for storing the thread trace mem meta */
- trace->lcore_meta = realloc(trace->lcore_meta,
- sizeof(trace->lcore_meta[0]) * (count + 1));
+ t->lcore_meta = realloc(t->lcore_meta,
+ sizeof(t->lcore_meta[0]) * (count + 1));
/* Provide dummy space for fast path to consume */
- if (trace->lcore_meta == NULL) {
+ if (t->lcore_meta == NULL) {
trace_crit("trace mem meta memory realloc failed");
header = NULL;
@@ -358,12 +357,12 @@ __rte_trace_mem_per_thread_alloc(void)
/* First attempt from huge page */
- header = eal_malloc_no_trace(NULL, trace_mem_sz(trace->buff_len), 8);
+ header = eal_malloc_no_trace(NULL, trace_mem_sz(t->buff_len), 8);
if (header) {
- trace->lcore_meta[count].area = TRACE_AREA_HUGEPAGE;
+ t->lcore_meta[count].area = TRACE_AREA_HUGEPAGE;
goto found;
}
/* Second attempt from heap with proper alignment */
- size_t mem_size = trace_mem_sz(trace->buff_len);
+ size_t mem_size = trace_mem_sz(t->buff_len);
void *aligned_ptr = NULL;
int ret = posix_memalign(&aligned_ptr, 8, mem_size);
@@ -377,12 +376,12 @@ __rte_trace_mem_per_thread_alloc(void)
/* Second attempt from heap is success */
- trace->lcore_meta[count].area = TRACE_AREA_HEAP;
+ t->lcore_meta[count].area = TRACE_AREA_HEAP;
/* Initialize the trace header */
found:
header->offset = 0;
- header->len = trace->buff_len;
+ header->len = t->buff_len;
header->stream_header.magic = TRACE_CTF_MAGIC;
- rte_uuid_copy(header->stream_header.uuid, trace->uuid);
+ rte_uuid_copy(header->stream_header.uuid, t->uuid);
header->stream_header.lcore_id = rte_lcore_id();
@@ -393,9 +392,9 @@ found:
__RTE_TRACE_EMIT_STRING_LEN_MAX);
- trace->lcore_meta[count].mem = header;
- trace->nb_trace_mem_list++;
+ t->lcore_meta[count].mem = header;
+ t->nb_trace_mem_list++;
fail:
RTE_PER_LCORE(trace_mem) = header;
- rte_spinlock_unlock(&trace->lock);
+ rte_spinlock_unlock(&t->lock);
}
@@ -412,5 +411,5 @@ void
trace_mem_per_thread_free(void)
{
- struct trace *trace = trace_obj_get();
+ struct trace *t = trace_obj_get();
struct __rte_trace_header *header;
uint32_t count;
@@ -420,21 +419,21 @@ trace_mem_per_thread_free(void)
return;
- rte_spinlock_lock(&trace->lock);
- for (count = 0; count < trace->nb_trace_mem_list; count++) {
- if (trace->lcore_meta[count].mem == header)
+ rte_spinlock_lock(&t->lock);
+ for (count = 0; count < t->nb_trace_mem_list; count++) {
+ if (t->lcore_meta[count].mem == header)
break;
}
- if (count != trace->nb_trace_mem_list) {
- struct thread_mem_meta *meta = &trace->lcore_meta[count];
+ if (count != t->nb_trace_mem_list) {
+ struct thread_mem_meta *meta = &t->lcore_meta[count];
trace_mem_per_thread_free_unlocked(meta);
- if (count != trace->nb_trace_mem_list - 1) {
+ if (count != t->nb_trace_mem_list - 1) {
memmove(meta, meta + 1,
sizeof(*meta) *
- (trace->nb_trace_mem_list - count - 1));
+ (t->nb_trace_mem_list - count - 1));
}
- trace->nb_trace_mem_list--;
+ t->nb_trace_mem_list--;
}
- rte_spinlock_unlock(&trace->lock);
+ rte_spinlock_unlock(&t->lock);
}
@@ -442,13 +441,12 @@ void
trace_mem_free(void)
{
- struct trace *trace = trace_obj_get();
+ struct trace *t = trace_obj_get();
uint32_t count;
- rte_spinlock_lock(&trace->lock);
- for (count = 0; count < trace->nb_trace_mem_list; count++) {
- trace_mem_per_thread_free_unlocked(&trace->lcore_meta[count]);
- }
- trace->nb_trace_mem_list = 0;
- rte_spinlock_unlock(&trace->lock);
+ rte_spinlock_lock(&t->lock);
+ for (count = 0; count < t->nb_trace_mem_list; count++)
+ trace_mem_per_thread_free_unlocked(&t->lcore_meta[count]);
+ t->nb_trace_mem_list = 0;
+ rte_spinlock_unlock(&t->lock);
}
diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
index 13a56e490e..39240c261c 100644
--- a/lib/eal/common/malloc_heap.c
+++ b/lib/eal/common/malloc_heap.c
@@ -1045,7 +1045,7 @@ free_unlock:
if (unmapped) {
void *asan_end = RTE_PTR_ADD(asan_ptr, asan_data_len);
- void *aligned_end = RTE_PTR_ADD(aligned_start, aligned_len);
void *aligned_trailer = RTE_PTR_SUB(aligned_start,
MALLOC_ELEM_TRAILER_LEN);
+ aligned_end = RTE_PTR_ADD(aligned_start, aligned_len);
/*
--
2.53.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-02-26 10:16:47.433225978 +0000
+++ 0006-eal-fix-variable-shadowing.patch 2026-02-26 10:16:46.882458936 +0000
@@ -1 +1 @@
-From 68c2dde1d441cda8e5656e46b018f7a39e47a669 Mon Sep 17 00:00:00 2001
+From f9423a7e0083291f4e4892169b02e695d6a19673 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 68c2dde1d441cda8e5656e46b018f7a39e47a669 ]
+
@@ -22 +23,0 @@
-Cc: stable at dpdk.org
@@ -34 +35 @@
-index 9ac2509c7c..485655865d 100644
+index b1fb670ea0..c53d10fd27 100644
@@ -37 +38 @@
-@@ -341,19 +341,19 @@ handle_eal_info_request(const char *cmd, const char *params __rte_unused,
+@@ -340,19 +340,19 @@ handle_eal_info_request(const char *cmd, const char *params __rte_unused,
@@ -63 +64 @@
-@@ -431,12 +431,12 @@ eal_clean_saved_args(void)
+@@ -430,12 +430,12 @@ eal_clean_saved_args(void)
@@ -80 +81 @@
-@@ -445,5 +445,5 @@ eal_option_device_add(enum rte_devtype type, const char *optarg)
+@@ -444,5 +444,5 @@ eal_option_device_add(enum rte_devtype type, const char *optarg)
More information about the stable
mailing list