summaryrefslogtreecommitdiffstats
path: root/tools/net/ynl/lib
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2023-03-09 13:25:26 +0100
committerJakub Kicinski <kuba@kernel.org>2023-03-10 21:33:47 -0800
commitbf51d27704c963ea52c0843096e23c9f404b13af (patch)
treed2026443dfe054bb7b5fdcc4af4712e0ba272a24 /tools/net/ynl/lib
parent8f76a4f80fba8096a611b6b60c40a0f4cab3ddfb (diff)
downloadlinux-bf51d27704c963ea52c0843096e23c9f404b13af.tar.gz
linux-bf51d27704c963ea52c0843096e23c9f404b13af.tar.bz2
linux-bf51d27704c963ea52c0843096e23c9f404b13af.zip
tools: ynl: fix get_mask utility routine
Fix get_mask utility routine in order to take into account possible gaps in the elements list. Fixes: be5bea1cc0bf ("net: add basic C code generators for Netlink") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/lib')
-rw-r--r--tools/net/ynl/lib/nlspec.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/net/ynl/lib/nlspec.py b/tools/net/ynl/lib/nlspec.py
index a34d088f6743..960a356e8225 100644
--- a/tools/net/ynl/lib/nlspec.py
+++ b/tools/net/ynl/lib/nlspec.py
@@ -138,10 +138,8 @@ class SpecEnumSet(SpecElement):
def get_mask(self):
mask = 0
- idx = self.yaml.get('value-start', 0)
- for _ in self.entries.values():
- mask |= 1 << idx
- idx += 1
+ for e in self.entries.values():
+ mask += e.user_value()
return mask