Skip to content

Commit 70eb391

Browse files
jmberg-intelkuba-moo
authored andcommitted
net: netlink: recommend policy range validation
For large ranges (outside of s16) the documentation currently recommends open-coding the validation, but it's better to use the NLA_POLICY_FULL_RANGE() or NLA_POLICY_FULL_RANGE_SIGNED() policy validation instead; recommend that. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://lore.kernel.org/r/20230127084506.09f280619d64.I5dece85f06efa8ab0f474ca77df9e26d3553d4ab@changeid Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2d104c3 commit 70eb391

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/net/netlink.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ enum nla_policy_validation {
276276
* Note that in the interest of code simplicity and
277277
* struct size both limits are s16, so you cannot
278278
* enforce a range that doesn't fall within the range
279-
* of s16 - do that as usual in the code instead.
279+
* of s16 - do that using the NLA_POLICY_FULL_RANGE()
280+
* or NLA_POLICY_FULL_RANGE_SIGNED() macros instead.
280281
* Use the NLA_POLICY_MIN(), NLA_POLICY_MAX() and
281282
* NLA_POLICY_RANGE() macros.
282283
* NLA_U8,

0 commit comments

Comments
 (0)