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: <ca02156a-16e3-499b-a0b2-e4bdccaeca97@gmail.com>
Date: Mon, 22 Jan 2024 21:31:59 +0100
From: Alessandro Marcolini <alessandromarcolini99@...il.com>
To: Breno Leitao <leitao@...ian.org>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
 pabeni@...hat.com, donald.hunter@...il.com, sdf@...gle.com,
 chuck.lever@...cle.com, lorenzo@...nel.org, jacob.e.keller@...el.com,
 jiri@...nulli.us, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 3/3] tools: ynl: add encoding support for
 'sub-message' to ynl

On 1/22/24 20:46, Breno Leitao wrote:
> This is a bit hard to read.
>
> Is it possible to make it a bit easier to read?

Hi! Yes, an easier to read version could be:

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index f8c56944f7e7..d837e769c5bf 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -459,12 +459,13 @@ class YnlFamily(SpecFamily):
             nl_type |= Netlink.NLA_F_NESTED
             attr_payload = b''
             # Check if it's a list of values (i.e. it contains multi-attr elements)
-            for subname, subvalue in (
-                ((k, v) for item in value for k, v in item.items())
-                if isinstance(value, list)
-                else value.items()
-            ):
-                attr_payload += self._add_attr(attr['nested-attributes'], subname, subvalue, vals)
+            if isinstance(value, list):
+                for item in value:
+                    for subname, subvalue in item.items():
+                        attr_payload += self._add_attr(attr['nested-attributes'], subname, subvalue, vals)
+            else:
+                for subname, subvalue in value.items():
+                    attr_payload += self._add_attr(attr['nested-attributes'], subname, subvalue, vals)
         elif attr["type"] == 'flag':
             attr_payload = b''
         elif attr["type"] == 'string':



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ