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]
Date: Thu, 24 Aug 2023 14:10:13 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net,  netdev@...r.kernel.org,  edumazet@...gle.com,
  pabeni@...hat.com
Subject: Re: [PATCH net-next 4/5] tools: ynl-gen: support empty attribute lists

Jakub Kicinski <kuba@...nel.org> writes:

> Differentiate between empty list and None for member lists.
> New families may want to create request responses with no attribute.
> If we treat those the same as None we end up rendering
> a full parsing policy in user space, instead of an empty one.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  tools/net/ynl/ynl-gen-c.py | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
> index 13d06931c045..9209bdcca9c6 100755
> --- a/tools/net/ynl/ynl-gen-c.py
> +++ b/tools/net/ynl/ynl-gen-c.py
> @@ -615,7 +615,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S
>  
>          self.attr_list = []
>          self.attrs = dict()
> -        if type_list:
> +        if type_list is not None:
>              for t in type_list:
>                  self.attr_list.append((t, self.attr_set[t]),)
>          else:
> @@ -1543,7 +1543,14 @@ _C_KW = {
>  
>      ri.cw.write_func_prot('int', f'{op_prefix(ri, "reply", deref=deref)}_parse', func_args)
>  
> -    _multi_parse(ri, ri.struct["reply"], init_lines, local_vars)
> +    if ri.struct["reply"].member_list():
> +        _multi_parse(ri, ri.struct["reply"], init_lines, local_vars)
> +    else:
> +        # Empty reply
> +        ri.cw.block_start()
> +        ri.cw.p('return MNL_CB_OK;')
> +        ri.cw.block_end()
> +        ri.cw.nl()
>  
>  
>  def print_req(ri):

Reviewed-by: Donald Hunter <donald.hunter@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ