mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
ethtool: trim policy tables
Since ethtool uses strict attribute validation there's no need to initialize all attributes in policy tables. 0 is NLA_UNSPEC which is going to be rejected. Remove the NLA_REJECTs. Similarly attributes above maxattrs are rejected, so there's no need to always size the policy tables to ETHTOOL_A_..._MAX. v2: - new patch Suggested-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
5028588b62
commit
ff419afa43
@@ -18,11 +18,8 @@ struct privflags_reply_data {
|
||||
#define PRIVFLAGS_REPDATA(__reply_base) \
|
||||
container_of(__reply_base, struct privflags_reply_data, base)
|
||||
|
||||
const struct nla_policy
|
||||
ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1] = {
|
||||
[ETHTOOL_A_PRIVFLAGS_UNSPEC] = { .type = NLA_REJECT },
|
||||
const struct nla_policy ethnl_privflags_get_policy[] = {
|
||||
[ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED },
|
||||
[ETHTOOL_A_PRIVFLAGS_FLAGS] = { .type = NLA_REJECT },
|
||||
};
|
||||
|
||||
static int ethnl_get_priv_flags_info(struct net_device *dev,
|
||||
@@ -135,9 +132,7 @@ const struct ethnl_request_ops ethnl_privflags_request_ops = {
|
||||
|
||||
/* PRIVFLAGS_SET */
|
||||
|
||||
const struct nla_policy
|
||||
ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_MAX + 1] = {
|
||||
[ETHTOOL_A_PRIVFLAGS_UNSPEC] = { .type = NLA_REJECT },
|
||||
const struct nla_policy ethnl_privflags_set_policy[] = {
|
||||
[ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED },
|
||||
[ETHTOOL_A_PRIVFLAGS_FLAGS] = { .type = NLA_NESTED },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user