Skip to contentSkip to conversation

netlink: clarify attribute length check documentation

PATCH Applied Johannes Berg 2 participants 2 messages Nov 3, 2011 – Nov 4, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: clarify attribute length check documentation

From: Johannes Berg <[email protected]>

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.

---
 include/net/netlink.h |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
include/net/netlink.h +9 -2
@@ -192,8 +192,15 @@ enum {
  *    NLA_NUL_STRING       Maximum length of string (excluding NUL)
  *    NLA_FLAG             Unused
  *    NLA_BINARY           Maximum length of attribute payload
- *    NLA_NESTED_COMPAT    Exact length of structure payload
- *    All other            Exact length of attribute payload
+ *    NLA_NESTED           Don't use `len' field -- length verification is
+ *                         done by checking len of nested header (or empty)
+ *    NLA_NESTED_COMPAT    Minimum length of structure payload
+ *    NLA_U8, NLA_U16,
+ *    NLA_U32, NLA_U64,
+ *    NLA_MSECS            Leaving the length field zero will verify the
+ *                         given type fits, using it verifies minimum length
+ *                         just like "All other"
+ *    All other            Minimum length of attribute payload
  *
  * Example:
  * static const struct nla_policy my_policy[ATTR_MAX+1] = {
maintainer Applied
#1 lore raw

From: Johannes Berg <[email protected]>
Date: Thu, 03 Nov 2011 11:10:05 +0100

Quoted 10 lines

From: Johannes Berg <[email protected]>

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.

Applied.