Skip to content

Commit

Permalink
tools: ynl: fix get_mask utility routine
Browse files Browse the repository at this point in the history
Fix get_mask utility routine in order to take into account possible gaps
in the elements list.

Fixes: be5bea1 ("net: add basic C code generators for Netlink")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Lorenzo Bianconi authored and Jakub Kicinski committed Mar 11, 2023
1 parent 8f76a4f commit bf51d27
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/net/ynl/lib/nlspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ def has_doc(self):

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


Expand Down

0 comments on commit bf51d27

Please sign in to comment.