Commit 48fde90a authored by Johannes Berg's avatar Johannes Berg Committed by David S. Miller

netlink: make validation_data const

The validation data is only used within the policy that
should usually already be const, and isn't changed in any
code that uses it. Therefore, make the validation_data
pointer const.

While at it, remove the duplicate variable in the bitfield
validation that I'd otherwise have to change to const.
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe3b30dd
...@@ -237,7 +237,7 @@ enum { ...@@ -237,7 +237,7 @@ enum {
struct nla_policy { struct nla_policy {
u16 type; u16 type;
u16 len; u16 len;
void *validation_data; const void *validation_data;
}; };
#define NLA_POLICY_EXACT_LEN(_len) { .type = NLA_EXACT_LEN, .len = _len } #define NLA_POLICY_EXACT_LEN(_len) { .type = NLA_EXACT_LEN, .len = _len }
......
...@@ -45,12 +45,11 @@ static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = { ...@@ -45,12 +45,11 @@ static const u8 nla_attr_minlen[NLA_TYPE_MAX+1] = {
}; };
static int validate_nla_bitfield32(const struct nlattr *nla, static int validate_nla_bitfield32(const struct nlattr *nla,
u32 *valid_flags_allowed) const u32 *valid_flags_mask)
{ {
const struct nla_bitfield32 *bf = nla_data(nla); const struct nla_bitfield32 *bf = nla_data(nla);
u32 *valid_flags_mask = valid_flags_allowed;
if (!valid_flags_allowed) if (!valid_flags_mask)
return -EINVAL; return -EINVAL;
/*disallow invalid bit selector */ /*disallow invalid bit selector */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment