mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 12:35:52 +02:00
macsec: replace custom checks on MACSEC_SA_ATTR_SALT with NLA_POLICY_EXACT_LEN
The existing checks already specify that MACSEC_SA_ATTR_SALT must have length MACSEC_SALT_LEN. Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/9699c5fd72322118b164cc8777fadabcce3b997c.1756202772.git.sd@queasysnail.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ae6a8f5abe
commit
8cf22afc15
|
|
@ -1677,8 +1677,7 @@ static const struct nla_policy macsec_genl_sa_policy[NUM_MACSEC_SA_ATTR] = {
|
|||
[MACSEC_SA_ATTR_KEY] = { .type = NLA_BINARY,
|
||||
.len = MACSEC_MAX_KEY_LEN, },
|
||||
[MACSEC_SA_ATTR_SSCI] = { .type = NLA_U32 },
|
||||
[MACSEC_SA_ATTR_SALT] = { .type = NLA_BINARY,
|
||||
.len = MACSEC_SALT_LEN, },
|
||||
[MACSEC_SA_ATTR_SALT] = NLA_POLICY_EXACT_LEN(MACSEC_SALT_LEN),
|
||||
};
|
||||
|
||||
static const struct nla_policy macsec_genl_offload_policy[NUM_MACSEC_OFFLOAD_ATTR] = {
|
||||
|
|
@ -1799,14 +1798,6 @@ static int macsec_add_rxsa(struct sk_buff *skb, struct genl_info *info)
|
|||
rtnl_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) {
|
||||
pr_notice("macsec: nl: add_rxsa: bad salt length: %d != %d\n",
|
||||
nla_len(tb_sa[MACSEC_SA_ATTR_SALT]),
|
||||
MACSEC_SALT_LEN);
|
||||
rtnl_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
rx_sa = rtnl_dereference(rx_sc->sa[assoc_num]);
|
||||
|
|
@ -2029,14 +2020,6 @@ static int macsec_add_txsa(struct sk_buff *skb, struct genl_info *info)
|
|||
rtnl_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (nla_len(tb_sa[MACSEC_SA_ATTR_SALT]) != MACSEC_SALT_LEN) {
|
||||
pr_notice("macsec: nl: add_txsa: bad salt length: %d != %d\n",
|
||||
nla_len(tb_sa[MACSEC_SA_ATTR_SALT]),
|
||||
MACSEC_SALT_LEN);
|
||||
rtnl_unlock();
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
tx_sa = rtnl_dereference(tx_sc->sa[assoc_num]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user