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: Tue, 25 Jul 2023 13:53:52 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
Cc: kuba@...nel.org,  netdev@...r.kernel.org,  davem@...emloft.net,
  pabeni@...hat.com,  edumazet@...gle.com,  simon.horman@...igine.com
Subject: Re: [PATCH net-next v5 1/2] tools: ynl-gen: fix enum index in
 _decode_enum(..)

Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com> writes:

> Remove wrong index adjustment, which is leftover from adding
> support for sparse enums.
> enum.entries_by_val() function shall not subtract the start-value, as
> it is indexed with real enum value.
>
> Fixes: c311aaa74ca1 ("tools: ynl: fix enum-as-flags in the generic CLI")
> Signed-off-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
> ---
>  tools/net/ynl/lib/ynl.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 1b3a36fbb1c3..027b1c0aecb4 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -420,8 +420,8 @@ class YnlFamily(SpecFamily):
>      def _decode_enum(self, rsp, attr_spec):
>          raw = rsp[attr_spec['name']]
>          enum = self.consts[attr_spec['enum']]
> -        i = attr_spec.get('value-start', 0)
>          if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
> +            i = 0
>              value = set()
>              while raw:
>                  if raw & 1:
> @@ -429,7 +429,7 @@ class YnlFamily(SpecFamily):
>                  raw >>= 1
>                  i += 1
>          else:
> -            value = enum.entries_by_val[raw - i].name
> +            value = enum.entries_by_val[raw].name
>          rsp[attr_spec['name']] = value
>  
>      def _decode_binary(self, attr, attr_spec):

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ