Subject: Re: [PATCH net-next 4/4] net/sched: speedup tc_dump_qdisc() when tcm_ifindex is provided

From: Jakub Kicinski <[email-masked]>
Date: Tue, 28 Apr 2026 10:20:08 -0700

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.