[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230929134742.1292632-4-jiri@resnulli.us>
Date: Fri, 29 Sep 2023 15:47:42 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: kuba@...nel.org,
pabeni@...hat.com,
davem@...emloft.net,
edumazet@...gle.com,
donald.hunter@...il.com
Subject: [patch net-next v2 3/3] tools: ynl-gen: raise exception when subset attribute contains more than "name" key
From: Jiri Pirko <jiri@...dia.com>
The only key used in the elem dictionary is "name" to lookup the real
attribute of a set. Raise exception in case there are other keys
present.
Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
v1->v2:
- new patch
---
tools/net/ynl/lib/nlspec.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index 37bcb4d8b37b..12e15ac70309 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -208,6 +208,8 @@ class SpecAttrSet(SpecElement):
attr = real_set[elem['name']]
self.attrs[attr.name] = attr
self.attrs_by_val[attr.value] = attr
+ if (len(elem.keys()) > 1):
+ raise Exception(f"Subset attribute '{elem['name']}' contains other keys")
def new_attr(self, elem, value):
return SpecAttr(self.family, self, elem, value)
--
2.41.0
Powered by blists - more mailing lists