Commit 4b6cc7284ddc9a54910f111085ebf0143ef3f5bd
Committed by
David S. Miller
1 parent
c30bc94758
Exists in
master
and in
6 other branches
netlink: clarify attribute length check documentation
The documentation for how the length of attributes is checked is wrong ("Exact length" isn't true, the policy checks are for "minimum length") and a bit misleading. Make it more complete and explain what really happens. Cc: Thomas Graf <tgraf@suug.ch> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff
include/net/netlink.h
... | ... | @@ -192,8 +192,15 @@ |
192 | 192 | * NLA_NUL_STRING Maximum length of string (excluding NUL) |
193 | 193 | * NLA_FLAG Unused |
194 | 194 | * NLA_BINARY Maximum length of attribute payload |
195 | - * NLA_NESTED_COMPAT Exact length of structure payload | |
196 | - * All other Exact length of attribute payload | |
195 | + * NLA_NESTED Don't use `len' field -- length verification is | |
196 | + * done by checking len of nested header (or empty) | |
197 | + * NLA_NESTED_COMPAT Minimum length of structure payload | |
198 | + * NLA_U8, NLA_U16, | |
199 | + * NLA_U32, NLA_U64, | |
200 | + * NLA_MSECS Leaving the length field zero will verify the | |
201 | + * given type fits, using it verifies minimum length | |
202 | + * just like "All other" | |
203 | + * All other Minimum length of attribute payload | |
197 | 204 | * |
198 | 205 | * Example: |
199 | 206 | * static const struct nla_policy my_policy[ATTR_MAX+1] = { |