lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM0EoMn1U+1WpfaVPkN+WfEd6RP2sb-cwMU_J7aPa88bwf4LaQ@mail.gmail.com>
Date: Wed, 20 Sep 2023 18:56:08 -0400
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Willem de Bruijn <willemb@...gle.com>, 
	Soheil Hassas Yeganeh <soheil@...gle.com>, Neal Cardwell <ncardwell@...gle.com>, 
	Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org, 
	eric.dumazet@...il.com
Subject: Re: [PATCH v2 net-next 1/5] net_sched: constify qdisc_priv()

On Wed, Sep 20, 2023 at 5:32 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Wed, Sep 20, 2023 at 10:45 PM Jamal Hadi Salim <jhs@...atatu.com> wrote:
> >
> > On Wed, Sep 20, 2023 at 4:17 PM Eric Dumazet <edumazet@...gle.com> wrote:
> > >
> > > In order to propagate const qualifiers, we change qdisc_priv()
> > > to accept a possibly const argument.
> > >
> > > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > > ---
> > >  include/net/pkt_sched.h | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
> > > index 15960564e0c364ef430f1e3fcdd0e835c2f94a77..9fa1d0794dfa5241705f9a39c896ed44519a9f13 100644
> > > --- a/include/net/pkt_sched.h
> > > +++ b/include/net/pkt_sched.h
> > > @@ -20,10 +20,10 @@ struct qdisc_walker {
> > >         int     (*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);
> > >  };
> > >
> > > -static inline void *qdisc_priv(struct Qdisc *q)
> > > -{
> > > -       return &q->privdata;
> > > -}
> > > +#define qdisc_priv(q)                                                  \
> > > +       _Generic(q,                                                     \
> > > +                const struct Qdisc * : (const void *)&q->privdata,     \
> > > +                struct Qdisc * : (void *)&q->privdata)
> >
> > Didnt know you could do this - C11? Would old compilers work here or
> > do we have some standardization version around compiler versions?
>
> We already use this in the tree, I would not worry for more instances
> of _Generic()
>

Cool ;->

cheers,
jamal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ