tools: ynl-gen: use macro for binary min-len check
This patch changes the generated min-len check for binary attributes to use the NLA_POLICY_MIN_LEN() macro, thereby the generated code supports strict policy validation. With this change TypeBinary will always generate a NLA_BINARY attribute policy. This doesn't change any currently generated code, as it isn't used in any specs currently used for generating code. Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net> Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250902154640.759815-3-ast@fiberby.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
9f9581ba74
commit
5fece05445
@@ -556,7 +556,7 @@ class TypeBinary(Type):
|
||||
elif 'exact-len' in self.checks:
|
||||
mem = 'NLA_POLICY_EXACT_LEN(' + self.get_limit_str('exact-len') + ')'
|
||||
elif 'min-len' in self.checks:
|
||||
mem = '{ .len = ' + self.get_limit_str('min-len') + ', }'
|
||||
mem = 'NLA_POLICY_MIN_LEN(' + self.get_limit_str('min-len') + ')'
|
||||
elif 'max-len' in self.checks:
|
||||
mem = 'NLA_POLICY_MAX_LEN(' + self.get_limit_str('max-len') + ')'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user