From: Stephen Hemminger <stephen@networkplumber.org>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org,
Stephen Hemminger <stephen@networkplumber.org>,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: [PATCH iproute2-next 05/10] tc: rename and drop shadowing locals
Date: Mon, 30 Nov 2026 10:47:06 -0800 [thread overview]
Message-ID: <20261130184752.545119-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20261130184752.545119-1-stephen@networkplumber.org>
do_tcmonitor() opens its own handle in a local named rth, shadowing the
global declared in tc_common.h; rename it to mrth.
route_print_opt() invokes SPRINT_BUF(b1) twice in the same function and
print_pedit() redeclares int err while the enclosing one is not yet
live; drop the inner declarations.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
tc/f_route.c | 1 -
tc/m_pedit.c | 2 --
tc/tc_monitor.c | 12 ++++++------
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/tc/f_route.c b/tc/f_route.c
index c234ddf0..be313784 100644
--- a/tc/f_route.c
+++ b/tc/f_route.c
@@ -150,7 +150,6 @@ static int route_print_opt(const struct filter_util *qu, FILE *f, struct rtattr
print_uint(PRINT_ANY, "order", "order %d ", (handle >> 8) & 0x7F);
if (tb[TCA_ROUTE4_CLASSID]) {
- SPRINT_BUF(b1);
print_string(PRINT_ANY, "flowid", "flowid %s ",
sprint_tc_classid(rta_getattr_u32(tb[TCA_ROUTE4_CLASSID]), b1));
}
diff --git a/tc/m_pedit.c b/tc/m_pedit.c
index 040d6168..07360c04 100644
--- a/tc/m_pedit.c
+++ b/tc/m_pedit.c
@@ -766,8 +766,6 @@ static int print_pedit(const struct action_util *au, FILE *f, struct rtattr *arg
if (tb[TCA_PEDIT_PARMS]) {
sel = RTA_DATA(tb[TCA_PEDIT_PARMS]);
} else {
- int err;
-
sel = RTA_DATA(tb[TCA_PEDIT_PARMS_EX]);
if (!tb[TCA_PEDIT_KEYS_EX]) {
diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c
index 5b9bccbe..fdbe6e4e 100644
--- a/tc/tc_monitor.c
+++ b/tc/tc_monitor.c
@@ -67,7 +67,7 @@ static int accept_tcmsg(struct rtnl_ctrl_data *ctrl,
int do_tcmonitor(int argc, char **argv)
{
- struct rtnl_handle rth;
+ struct rtnl_handle mrth;
char *file = NULL;
unsigned int groups = nl_mgrp(RTNLGRP_TC);
@@ -100,16 +100,16 @@ int do_tcmonitor(int argc, char **argv)
return ret;
}
- if (rtnl_open(&rth, groups) < 0)
+ if (rtnl_open(&mrth, groups) < 0)
exit(1);
- ll_init_map(&rth);
+ ll_init_map(&mrth);
- if (rtnl_listen(&rth, accept_tcmsg, (void *)stdout) < 0) {
- rtnl_close(&rth);
+ if (rtnl_listen(&mrth, accept_tcmsg, (void *)stdout) < 0) {
+ rtnl_close(&mrth);
exit(2);
}
- rtnl_close(&rth);
+ rtnl_close(&mrth);
exit(0);
}
--
2.53.0
next prev parent reply other threads:[~2026-11-30 19:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 18:47 [PATCH iproute2-next 00/10] fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 01/10] xfrm: rename shadowed SA direction local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 02/10] ip address: rename the shadowed parameter of ipaddr_reset_filter() Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 03/10] lib: rename parameters that shadow globals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 04/10] xfrm: rename local netlink handles that shadow the global rth Stephen Hemminger
2026-11-30 18:47 ` Stephen Hemminger [this message]
2026-11-30 18:47 ` [PATCH iproute2-next 06/10] ip: rename and drop shadowing locals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 07/10] ifstat: rename shadowing local Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 08/10] bridge, devlink, rdma: rename shadowing locals Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 09/10] ss: fix shadowed variable warnings Stephen Hemminger
2026-11-30 18:47 ` [PATCH iproute2-next 10/10] Makefile: enable " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261130184752.545119-6-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dsahern@kernel.org \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox