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] [day] [month] [year] [list]
Message-ID: <m2msbmm9wx.fsf@gmail.com>
Date: Fri, 09 May 2025 10:05:18 +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,  andrew+netdev@...n.ch,  horms@...nel.org,
  jacob.e.keller@...el.com
Subject: Re: [PATCH net-next 1/3] tools: ynl-gen: support sub-type for
 binary attributes

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

> On Thu, 8 May 2025 12:33:10 +0100 Donald Hunter wrote:
>> >  class TypeBinary(Type):
>> >      def arg_member(self, ri):
>> > +        if self.get('sub-type') and self.get('sub-type') in scalars:  
>> 
>> This check is repeated a lot, so maybe it would benefit from a
>> _has_scalar_sub_type() helper?
>
> I've gotten used to repeating the conditions in TypeArrayNest 
> and TypeMultiAttr...
>
> Looking at it now, since I'm using .get() the part of the condition 
> is unnecessary. How about just:
>
> 	if self.get('sub-type') in scalars:
>
> ? None is not a scalar after all

That's definitely an improvement.

I realise that it's not so much the repeated conditions that concerns me
as the need to check in so many places. Perhaps there is a refactoring
that specialises TypeBinary?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ