Skip to content
Snippets Groups Projects
  • Johannes Berg's avatar
    23323289
    netlink: reduce NLA_POLICY_NESTED{,_ARRAY} arguments · 23323289
    Johannes Berg authored
    
    In typical cases, there's no need to pass both the maxattr
    and the policy array pointer, as the maxattr should just be
    ARRAY_SIZE(policy) - 1. Therefore, to be less error prone,
    just remove the maxattr argument from the default macros
    and deduce the size accordingly.
    
    Leave the original macros with a leading underscore to use
    here and in case somebody needs to pass a policy pointer
    where the policy isn't declared in the same place and thus
    ARRAY_SIZE() cannot be used.
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    23323289
    History
    netlink: reduce NLA_POLICY_NESTED{,_ARRAY} arguments
    Johannes Berg authored
    
    In typical cases, there's no need to pass both the maxattr
    and the policy array pointer, as the maxattr should just be
    ARRAY_SIZE(policy) - 1. Therefore, to be less error prone,
    just remove the maxattr argument from the default macros
    and deduce the size accordingly.
    
    Leave the original macros with a leading underscore to use
    here and in case somebody needs to pass a policy pointer
    where the policy isn't declared in the same place and thus
    ARRAY_SIZE() cannot be used.
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.