[RFC PATCH 09/19] pcapng: rename variable to fix shadowing
Bruce Richardson
bruce.richardson at intel.com
Thu Nov 6 15:09:38 CET 2025
The "len" variable is shadowed within a function, so rename inner use to
the more descriptive "filter_len" to fix the issue.
Fixes: d1da6d0d04c7 ("pcapng: require per-interface information")
Cc: stable at dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/pcapng/rte_pcapng.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 21bc94cea1..2cc9e2040d 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -296,16 +296,15 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port, uint16_t link_type,
opt = pcapng_add_option(opt, PCAPNG_IFB_HARDWARE,
ifhw, strlen(ifhw));
if (filter) {
- size_t len;
+ const size_t filter_len = strlen(filter) + 1;
- len = strlen(filter) + 1;
opt->code = PCAPNG_IFB_FILTER;
- opt->length = len;
+ opt->length = filter_len;
/* Encoding is that the first octet indicates string vs BPF */
opt->data[0] = 0;
memcpy(opt->data + 1, filter, strlen(filter));
- opt = (struct pcapng_option *)((uint8_t *)opt + pcapng_optlen(len));
+ opt = (struct pcapng_option *)((uint8_t *)opt + pcapng_optlen(filter_len));
}
opt = pcapng_add_option(opt, PCAPNG_OPT_END, NULL, 0);
--
2.48.1
More information about the dev
mailing list