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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713090234.28b04145@kernel.org>
Date:   Thu, 13 Jul 2023 09:02:34 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Arkadiusz Kubalewski <arkadiusz.kubalewski@...el.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com,
        chuck.lever@...cle.com
Subject: Re: [PATCH net-next 1/2 v2] tools: ynl-gen: fix enum index in
 _decode_enum(..)

On Thu, 13 Jul 2023 11:05:49 +0200 Arkadiusz Kubalewski wrote:
> -        i = attr_spec.get('value-start', 0)
>          if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:
>              value = set()
>              while raw:
>                  if raw & 1:
> -                    value.add(enum.entries_by_val[i].name)
> +                    value.add(enum.entries_by_val[raw & 1].name)
>                  raw >>= 1
> -                i += 1

This doesn't make sense, as I suggested you need to keep i for this
loop. Move it to the inside of the if 'enum-as-fla... and init to 0.

i is tracking which bit number we are at as we consume / shift out
bits from raw.

Have you ever used ChatGPT? No shame, just curious.
-- 
pw-bot: cr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ