From: Jamal Hadi Salim <jhs@mojatatu.com>
To: netdev@vger.kernel.org
Cc: "Jamal Hadi Salim" <jhs@mojatatu.com>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
"Jiri Pirko" <jiri@resnulli.us>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
"Victor Nogueira" <victor@mojatatu.com>,
cake@lists.bufferbloat.net
Subject: [PATCH net-next 4/4] net/sched/sch_cake: drop dead nla_nest_end() error check
Date: Thu, 8 Oct 2026 03:47:12 -0400 [thread overview]
Message-ID: <QDISC-5RTM.v1.20261007130704-5@mojatatu.com> (raw)
In-Reply-To: <QDISC-5RTM.v1.20261007130704@mojatatu.com>
cake_dump_class_stats() closes the TCA_STATS_APP nest with
if (nla_nest_end(d->skb, stats) < 0)
return -1;
nla_nest_end() never returns a negative value: it has a single
`return skb->len;` and no error path (that is why the overflow-aware
nla_nest_end_safe() helper was later added). The '< 0' test can never
be true, so the 'return -1' is unreachable dead code.
Drop the check and close the nest with the bare statement, matching the
sibling cake nests in the same file.
This issue was discovered while fixing a bug on the gate action, see:
https://lore.kernel.org/netdev/QDISC-H19Z.v1.20261001053234@mojatatu.com/
Conditions to recreate the bug:
- not runtime observable: the issue is found by inspection.
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
net/sched/sch_cake.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/sched/sch_cake.c b/net/sched/sch_cake.c
index 4caf9718c9bd..124f552023f8 100644
--- a/net/sched/sch_cake.c
+++ b/net/sched/sch_cake.c
@@ -3211,8 +3211,7 @@ static int cake_dump_class_stats(struct Qdisc *sch, unsigned long cl,
READ_ONCE(flow->cvars.drop_next))));
}
- if (nla_nest_end(d->skb, stats) < 0)
- return -1;
+ nla_nest_end(d->skb, stats);
}
return 0;
--
2.43.0
next prev parent reply other threads:[~2026-10-08 7:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 7:47 [PATCH net-next 0/4] net/sched: sch_cake: fixes for accounting and reconfiguration Jamal Hadi Salim
2026-10-08 7:47 ` [PATCH net-next 1/4] net/sched/sch_cake: serialize reconfiguration with the datapath Jamal Hadi Salim
2026-10-08 10:06 ` Toke Høiland-Jørgensen
2026-10-08 11:53 ` Jamal Hadi Salim
2026-10-08 12:03 ` Toke Høiland-Jørgensen
2026-10-08 7:47 ` [PATCH net-next 2/4] net/sched/sch_cake: reduce parent backlog when clearing a tin Jamal Hadi Salim
2026-10-08 10:19 ` Toke Høiland-Jørgensen
2026-10-08 7:47 ` [PATCH net-next 3/4] net/sched/sch_cake: widen buffer_used to u64 Jamal Hadi Salim
2026-10-08 10:24 ` Toke Høiland-Jørgensen
2026-10-08 7:47 ` Jamal Hadi Salim [this message]
2026-10-08 10:24 ` [PATCH net-next 4/4] net/sched/sch_cake: drop dead nla_nest_end() error check Toke Høiland-Jørgensen
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=QDISC-5RTM.v1.20261007130704-5@mojatatu.com \
--to=jhs@mojatatu.com \
--cc=cake@lists.bufferbloat.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@toke.dk \
--cc=victor@mojatatu.com \
/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