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: <ZAhjPNfv8PVKSpw2@lore-desk>
Date:   Wed, 8 Mar 2023 11:28:12 +0100
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org, davem@...emloft.net,
        edumazet@...gle.com, pabeni@...hat.com, ast@...nel.org,
        daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
        saeedm@...dia.com, tariqt@...dia.com, leon@...nel.org,
        shayagr@...zon.com, akiyano@...zon.com, darinzon@...zon.com,
        sgoutham@...vell.com, lorenzo.bianconi@...hat.com, toke@...hat.com,
        teknoraver@...a.com
Subject: Re: [PATCH net-next 1/8] tools: ynl: fix render-max for flags
 definition

> On Tue,  7 Mar 2023 15:53:58 +0100 Lorenzo Bianconi wrote:
> > Properly manage render-max property for flags definition type
> > introducing mask value and setting it to (last_element << 1) - 1
> > instead of adding max value set to last_element + 1
> > 
> > Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink")
> > Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> > ---
> >  tools/net/ynl/ynl-gen-c.py | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> > index 274e9c566f61..f2e41dd962d4 100755
> > --- a/tools/net/ynl/ynl-gen-c.py
> > +++ b/tools/net/ynl/ynl-gen-c.py
> > @@ -1995,9 +1995,14 @@ def render_uapi(family, cw):
> >  
> >              if const.get('render-max', False):
> >                  cw.nl()
> > -                max_name = c_upper(name_pfx + 'max')
> > -                cw.p('__' + max_name + ',')
> > -                cw.p(max_name + ' = (__' + max_name + ' - 1)')
> > +                if const['type'] == 'flags':
> > +                    max_name = c_upper(name_pfx + 'mask')
> > +                    max_val = f' = {(entry.user_value() << 1) - 1},'
> 
> Hm, why not use const.get_mask() here? Rather than the last entry?

actually I did this change but it ended up in patch 3/8. I will fix it in v2.

Regards,
Lorenzo

> 
> > +                    cw.p(max_name + max_val)
> > +                else:
> > +                    max_name = c_upper(name_pfx + 'max')
> > +                    cw.p('__' + max_name + ',')
> > +                    cw.p(max_name + ' = (__' + max_name + ' - 1)')
> >              cw.block_end(line=';')
> >              cw.nl()
> >          elif const['type'] == 'const':
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ