diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-01-27 10:45:06 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-01-28 11:33:51 +0300 |
commit | 70eb3911d80f548a76fb9a40c8a3fd93ac061a42 (patch) | |
tree | 1fa5cc3d57c721a5a96926a54dfa6f3e04e2aa8e /include/net/netlink.h | |
parent | 2d104c390f0d3901c4915dcb141cb96da96cffe7 (diff) | |
download | linux-70eb3911d80f548a76fb9a40c8a3fd93ac061a42.tar.xz |
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>
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r-- | include/net/netlink.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index 6e1e670e06bc..b12cd957abb4 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -276,7 +276,8 @@ enum nla_policy_validation { * Note that in the interest of code simplicity and * struct size both limits are s16, so you cannot * enforce a range that doesn't fall within the range - * of s16 - do that as usual in the code instead. + * of s16 - do that using the NLA_POLICY_FULL_RANGE() + * or NLA_POLICY_FULL_RANGE_SIGNED() macros instead. * Use the NLA_POLICY_MIN(), NLA_POLICY_MAX() and * NLA_POLICY_RANGE() macros. * NLA_U8, |