All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 4/4] net/sched: speedup tc_dump_qdisc() when tcm_ifindex is provided
Date: Tue, 28 Apr 2026 10:20:08 -0700	[thread overview]
Message-ID: <20260428102008.6f3aa32c@kernel.org> (raw)
In-Reply-To: <CANn89iJ4MjaQP047jWFBquLd+ed-QfEOx3fUMUTdw328NOHc9Q@mail.gmail.com>

On Tue, 28 Apr 2026 08:40:52 -0700 Eric Dumazet wrote:
> > On Mon, 27 Apr 2026 13:25:55 +0000 Eric Dumazet wrote:  
> > >  static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
> > >  {
> > >       const struct nlmsghdr *nlh = cb->nlh;
> > > +     const struct tcmsg *tcm = nlmsg_data(nlh);  
> >
> > nit: breaks reverse xmas tree
> >
> > I added this tcm assignment after parsing:
> >
> >         err = nlmsg_parse_deprecated(nlh, sizeof(struct tcmsg), tca, TCA_MAX,
> >                                      rtm_tca_policy, cb->extack);
> >         if (err < 0)
> >                 return err;
> > +       tcm = nlmsg_data(nlh);
> >
> > because nlmsg_parse validates the struct is in range of skb->len  
> 
> Note tc_get_qdisc() and tc_ctl_tclass() use tcm = nlmsg_data(n) before
> validation.
> 
> Do they need to be changed?

To be clear - I just mean that as a coding nit pick.
I seem to recall that some AI was flagging this as a bug, it's not
really a bug. But if we're touching the code I think it's easier to
everyone to follow if the nlmsg_data() is after the validation.

  reply	other threads:[~2026-04-28 17:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 13:25 [PATCH net-next 0/4] net/sched: tc_dump_qdisc() optimizations Eric Dumazet
2026-04-27 13:25 ` [PATCH net-next 1/4] net/sched: propagate tc_fill_tclass() error Eric Dumazet
2026-04-27 13:25 ` [PATCH net-next 2/4] net/sched: tc_dump_qdisc_root() refactor Eric Dumazet
2026-04-27 23:08   ` Jakub Kicinski
2026-04-28 15:48     ` Eric Dumazet
2026-04-27 13:25 ` [PATCH net-next 3/4] net/sched: switch tc_dump_qdisc() to for_each_netdev_dump() Eric Dumazet
2026-04-27 23:13   ` Jakub Kicinski
2026-04-28 15:57     ` Eric Dumazet
2026-04-27 13:25 ` [PATCH net-next 4/4] net/sched: speedup tc_dump_qdisc() when tcm_ifindex is provided Eric Dumazet
2026-04-27 23:18   ` Jakub Kicinski
2026-04-28 15:40     ` Eric Dumazet
2026-04-28 17:20       ` Jakub Kicinski [this message]
2026-04-28 17:26         ` Eric Dumazet
2026-04-27 23:02 ` [PATCH net-next 0/4] net/sched: tc_dump_qdisc() optimizations Jakub Kicinski

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=20260428102008.6f3aa32c@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.