diff --git a/net/ethtool/cabletest.c b/net/ethtool/cabletest.c index 6f3328be65926709ddfd58460a1906ad019d0098..63560bbb7d1f0b4a4ca76b2986e896d922bd7745 100644 --- a/net/ethtool/cabletest.c +++ b/net/ethtool/cabletest.c @@ -12,7 +12,8 @@ #define MAX_CABLE_LENGTH_CM (150 * 100) const struct nla_policy ethnl_cable_test_act_policy[] = { - [ETHTOOL_A_CABLE_TEST_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_CABLE_TEST_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int ethnl_cable_test_started(struct phy_device *phydev, u8 cmd) @@ -218,7 +219,8 @@ static const struct nla_policy cable_test_tdr_act_cfg_policy[] = { }; const struct nla_policy ethnl_cable_test_tdr_act_policy[] = { - [ETHTOOL_A_CABLE_TEST_TDR_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_CABLE_TEST_TDR_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_CABLE_TEST_TDR_CFG] = { .type = NLA_NESTED }, }; diff --git a/net/ethtool/channels.c b/net/ethtool/channels.c index 2a0cea0ad6488ccad850bb6c681ace5d4d6bb3c5..5635604cb9ba1e126143587d156419af1c4a61b7 100644 --- a/net/ethtool/channels.c +++ b/net/ethtool/channels.c @@ -18,7 +18,8 @@ struct channels_reply_data { container_of(__reply_base, struct channels_reply_data, base) const struct nla_policy ethnl_channels_get_policy[] = { - [ETHTOOL_A_CHANNELS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_CHANNELS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int channels_prepare_data(const struct ethnl_req_info *req_base, @@ -100,7 +101,8 @@ const struct ethnl_request_ops ethnl_channels_request_ops = { /* CHANNELS_SET */ const struct nla_policy ethnl_channels_set_policy[] = { - [ETHTOOL_A_CHANNELS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_CHANNELS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_CHANNELS_RX_COUNT] = { .type = NLA_U32 }, [ETHTOOL_A_CHANNELS_TX_COUNT] = { .type = NLA_U32 }, [ETHTOOL_A_CHANNELS_OTHER_COUNT] = { .type = NLA_U32 }, diff --git a/net/ethtool/coalesce.c b/net/ethtool/coalesce.c index c46d4247403a4d784d411aee3ed49996a95ae885..1d6bc132aa4d0707f89576589d624ae31bb4cf7a 100644 --- a/net/ethtool/coalesce.c +++ b/net/ethtool/coalesce.c @@ -52,7 +52,8 @@ __CHECK_SUPPORTED_OFFSET(COALESCE_TX_MAX_FRAMES_HIGH); __CHECK_SUPPORTED_OFFSET(COALESCE_RATE_SAMPLE_INTERVAL); const struct nla_policy ethnl_coalesce_get_policy[] = { - [ETHTOOL_A_COALESCE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_COALESCE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int coalesce_prepare_data(const struct ethnl_req_info *req_base, @@ -190,7 +191,8 @@ const struct ethnl_request_ops ethnl_coalesce_request_ops = { /* COALESCE_SET */ const struct nla_policy ethnl_coalesce_set_policy[] = { - [ETHTOOL_A_COALESCE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_COALESCE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_COALESCE_RX_USECS] = { .type = NLA_U32 }, [ETHTOOL_A_COALESCE_RX_MAX_FRAMES] = { .type = NLA_U32 }, [ETHTOOL_A_COALESCE_RX_USECS_IRQ] = { .type = NLA_U32 }, diff --git a/net/ethtool/debug.c b/net/ethtool/debug.c index dbd3243ccae5fade731a70ac8c69ca53c1cedc72..f99912d7957ead331a772dbdd70a64f0e374b7ae 100644 --- a/net/ethtool/debug.c +++ b/net/ethtool/debug.c @@ -17,7 +17,8 @@ struct debug_reply_data { container_of(__reply_base, struct debug_reply_data, base) const struct nla_policy ethnl_debug_get_policy[] = { - [ETHTOOL_A_DEBUG_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_DEBUG_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int debug_prepare_data(const struct ethnl_req_info *req_base, @@ -77,7 +78,8 @@ const struct ethnl_request_ops ethnl_debug_request_ops = { /* DEBUG_SET */ const struct nla_policy ethnl_debug_set_policy[] = { - [ETHTOOL_A_DEBUG_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_DEBUG_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_DEBUG_MSGMASK] = { .type = NLA_NESTED }, }; diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c index d40a573d1ebaec56c5c6c18cdd3f9a23cd3672ab..901b7de941abdbf22184bc0de8775ad4a212d0cc 100644 --- a/net/ethtool/eee.c +++ b/net/ethtool/eee.c @@ -20,7 +20,8 @@ struct eee_reply_data { container_of(__reply_base, struct eee_reply_data, base) const struct nla_policy ethnl_eee_get_policy[] = { - [ETHTOOL_A_EEE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_EEE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int eee_prepare_data(const struct ethnl_req_info *req_base, @@ -122,7 +123,8 @@ const struct ethnl_request_ops ethnl_eee_request_ops = { /* EEE_SET */ const struct nla_policy ethnl_eee_set_policy[] = { - [ETHTOOL_A_EEE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_EEE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_EEE_MODES_OURS] = { .type = NLA_NESTED }, [ETHTOOL_A_EEE_ENABLED] = { .type = NLA_U8 }, [ETHTOOL_A_EEE_TX_LPI_ENABLED] = { .type = NLA_U8 }, diff --git a/net/ethtool/features.c b/net/ethtool/features.c index 920386cf7d0aad638d235425794203a9041747ac..8ee4cdbd6b82f130ff97b7ca8f3ba043b12c3d83 100644 --- a/net/ethtool/features.c +++ b/net/ethtool/features.c @@ -21,7 +21,8 @@ struct features_reply_data { container_of(__reply_base, struct features_reply_data, base) const struct nla_policy ethnl_features_get_policy[] = { - [ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_FEATURES_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static void ethnl_features_to_bitmap32(u32 *dest, netdev_features_t src) @@ -125,7 +126,8 @@ const struct ethnl_request_ops ethnl_features_request_ops = { /* FEATURES_SET */ const struct nla_policy ethnl_features_set_policy[] = { - [ETHTOOL_A_FEATURES_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_FEATURES_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_FEATURES_WANTED] = { .type = NLA_NESTED }, }; diff --git a/net/ethtool/linkinfo.c b/net/ethtool/linkinfo.c index 0c9161801bc781a1278f0a933d4c92cc5b2dd192..b91839870efc990119a51fc5ff63e62f35643491 100644 --- a/net/ethtool/linkinfo.c +++ b/net/ethtool/linkinfo.c @@ -17,7 +17,8 @@ struct linkinfo_reply_data { container_of(__reply_base, struct linkinfo_reply_data, base) const struct nla_policy ethnl_linkinfo_get_policy[] = { - [ETHTOOL_A_LINKINFO_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_LINKINFO_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int linkinfo_prepare_data(const struct ethnl_req_info *req_base, @@ -87,7 +88,8 @@ const struct ethnl_request_ops ethnl_linkinfo_request_ops = { /* LINKINFO_SET */ const struct nla_policy ethnl_linkinfo_set_policy[] = { - [ETHTOOL_A_LINKINFO_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_LINKINFO_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_LINKINFO_PORT] = { .type = NLA_U8 }, [ETHTOOL_A_LINKINFO_PHYADDR] = { .type = NLA_U8 }, [ETHTOOL_A_LINKINFO_TP_MDIX_CTRL] = { .type = NLA_U8 }, diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c index dcef79b6a2d2c29d94209074d4bf7ba9131a0032..c5bcb9abc8b985bda6f32a32f9760aff64747985 100644 --- a/net/ethtool/linkmodes.c +++ b/net/ethtool/linkmodes.c @@ -19,7 +19,8 @@ struct linkmodes_reply_data { container_of(__reply_base, struct linkmodes_reply_data, base) const struct nla_policy ethnl_linkmodes_get_policy[] = { - [ETHTOOL_A_LINKMODES_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_LINKMODES_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int linkmodes_prepare_data(const struct ethnl_req_info *req_base, @@ -266,7 +267,8 @@ static const struct link_mode_info link_mode_params[] = { }; const struct nla_policy ethnl_linkmodes_set_policy[] = { - [ETHTOOL_A_LINKMODES_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_LINKMODES_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_LINKMODES_AUTONEG] = { .type = NLA_U8 }, [ETHTOOL_A_LINKMODES_OURS] = { .type = NLA_NESTED }, [ETHTOOL_A_LINKMODES_SPEED] = { .type = NLA_U32 }, diff --git a/net/ethtool/linkstate.c b/net/ethtool/linkstate.c index fc36e73d8b7f0297e5cd6ba1d068fb32638f111a..fb676f349455aed52ebc5cc5d8c5d42bf9c2b9f1 100644 --- a/net/ethtool/linkstate.c +++ b/net/ethtool/linkstate.c @@ -21,7 +21,8 @@ struct linkstate_reply_data { container_of(__reply_base, struct linkstate_reply_data, base) const struct nla_policy ethnl_linkstate_get_policy[] = { - [ETHTOOL_A_LINKSTATE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_LINKSTATE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int linkstate_get_sqi(struct net_device *dev) diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c index b8369ea54af1edc7de3353261345128c042027b6..10567e6ec0345d257b6f75b6dacf30d459ba5856 100644 --- a/net/ethtool/netlink.c +++ b/net/ethtool/netlink.c @@ -9,7 +9,7 @@ static struct genl_family ethtool_genl_family; static bool ethnl_ok __read_mostly; static u32 ethnl_bcast_seq; -static const struct nla_policy ethnl_header_policy[] = { +const struct nla_policy ethnl_header_policy[] = { [ETHTOOL_A_HEADER_DEV_INDEX] = { .type = NLA_U32 }, [ETHTOOL_A_HEADER_DEV_NAME] = { .type = NLA_NUL_STRING, .len = ALTIFNAMSIZ - 1 }, diff --git a/net/ethtool/netlink.h b/net/ethtool/netlink.h index 2cfbc016393c3bf47dc8168ccf292f9682f18382..281d793d4557ac0216bd3d6c497b32a01174de42 100644 --- a/net/ethtool/netlink.h +++ b/net/ethtool/netlink.h @@ -345,6 +345,7 @@ extern const struct ethnl_request_ops ethnl_pause_request_ops; extern const struct ethnl_request_ops ethnl_eee_request_ops; extern const struct ethnl_request_ops ethnl_tsinfo_request_ops; +extern const struct nla_policy ethnl_header_policy[ETHTOOL_A_HEADER_FLAGS + 1]; extern const struct nla_policy ethnl_strset_get_policy[ETHTOOL_A_STRSET_STRINGSETS + 1]; extern const struct nla_policy ethnl_linkinfo_get_policy[ETHTOOL_A_LINKINFO_HEADER + 1]; extern const struct nla_policy ethnl_linkinfo_set_policy[ETHTOOL_A_LINKINFO_TP_MDIX_CTRL + 1]; diff --git a/net/ethtool/pause.c b/net/ethtool/pause.c index 084798d629a8bbef34164dc5b07ddd091cdde988..bf4013afd8b2ae5a24330b4524f6baf7c7faac36 100644 --- a/net/ethtool/pause.c +++ b/net/ethtool/pause.c @@ -17,7 +17,8 @@ struct pause_reply_data { container_of(__reply_base, struct pause_reply_data, base) const struct nla_policy ethnl_pause_get_policy[] = { - [ETHTOOL_A_PAUSE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_PAUSE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static void ethtool_stats_init(u64 *stats, unsigned int n) @@ -135,7 +136,8 @@ const struct ethnl_request_ops ethnl_pause_request_ops = { /* PAUSE_SET */ const struct nla_policy ethnl_pause_set_policy[] = { - [ETHTOOL_A_PAUSE_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_PAUSE_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_PAUSE_AUTONEG] = { .type = NLA_U8 }, [ETHTOOL_A_PAUSE_RX] = { .type = NLA_U8 }, [ETHTOOL_A_PAUSE_TX] = { .type = NLA_U8 }, diff --git a/net/ethtool/privflags.c b/net/ethtool/privflags.c index 050d3d428a5992154f5a01a538d2fcab0a092adf..fc9f3be23a19d82236bd001024237fb191d0e53c 100644 --- a/net/ethtool/privflags.c +++ b/net/ethtool/privflags.c @@ -19,7 +19,8 @@ struct privflags_reply_data { container_of(__reply_base, struct privflags_reply_data, base) const struct nla_policy ethnl_privflags_get_policy[] = { - [ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_PRIVFLAGS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int ethnl_get_priv_flags_info(struct net_device *dev, @@ -133,7 +134,8 @@ const struct ethnl_request_ops ethnl_privflags_request_ops = { /* PRIVFLAGS_SET */ const struct nla_policy ethnl_privflags_set_policy[] = { - [ETHTOOL_A_PRIVFLAGS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_PRIVFLAGS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_PRIVFLAGS_FLAGS] = { .type = NLA_NESTED }, }; diff --git a/net/ethtool/rings.c b/net/ethtool/rings.c index da5d9041b2b12d1c3c1883b865a7511a9d2a563b..4e097812a967b15b1084ec9ff7c4575994529696 100644 --- a/net/ethtool/rings.c +++ b/net/ethtool/rings.c @@ -16,7 +16,8 @@ struct rings_reply_data { container_of(__reply_base, struct rings_reply_data, base) const struct nla_policy ethnl_rings_get_policy[] = { - [ETHTOOL_A_RINGS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_RINGS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int rings_prepare_data(const struct ethnl_req_info *req_base, @@ -98,7 +99,8 @@ const struct ethnl_request_ops ethnl_rings_request_ops = { /* RINGS_SET */ const struct nla_policy ethnl_rings_set_policy[] = { - [ETHTOOL_A_RINGS_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_RINGS_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_RINGS_RX] = { .type = NLA_U32 }, [ETHTOOL_A_RINGS_RX_MINI] = { .type = NLA_U32 }, [ETHTOOL_A_RINGS_RX_JUMBO] = { .type = NLA_U32 }, diff --git a/net/ethtool/strset.c b/net/ethtool/strset.c index 02199570c3fce19fc127093e62c8eff61cadfafc..0734e83c674c37f64d473a3adf4140b94f295405 100644 --- a/net/ethtool/strset.c +++ b/net/ethtool/strset.c @@ -100,7 +100,8 @@ struct strset_reply_data { container_of(__reply_base, struct strset_reply_data, base) const struct nla_policy ethnl_strset_get_policy[] = { - [ETHTOOL_A_STRSET_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_STRSET_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_STRSET_STRINGSETS] = { .type = NLA_NESTED }, }; diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c index 6f050b81b77cb60c5830c0c1270b06f754b78d03..63b5814bd460a4b1299f3a4797f3ce897126d66b 100644 --- a/net/ethtool/tsinfo.c +++ b/net/ethtool/tsinfo.c @@ -19,7 +19,8 @@ struct tsinfo_reply_data { container_of(__reply_base, struct tsinfo_reply_data, base) const struct nla_policy ethnl_tsinfo_get_policy[] = { - [ETHTOOL_A_TSINFO_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_TSINFO_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int tsinfo_prepare_data(const struct ethnl_req_info *req_base, diff --git a/net/ethtool/tunnels.c b/net/ethtool/tunnels.c index 48a52951917e1bcfa6829c30d4dbcadc668d3c23..e7f2ee0d2471977a57761a89f0a1764a7dce82b1 100644 --- a/net/ethtool/tunnels.c +++ b/net/ethtool/tunnels.c @@ -9,7 +9,8 @@ #include "netlink.h" const struct nla_policy ethnl_tunnel_info_get_policy[] = { - [ETHTOOL_A_TUNNEL_INFO_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_TUNNEL_INFO_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static_assert(ETHTOOL_UDP_TUNNEL_TYPE_VXLAN == ilog2(UDP_TUNNEL_TYPE_VXLAN)); diff --git a/net/ethtool/wol.c b/net/ethtool/wol.c index 7671089c119d3d254eb32abf8dc6ef756a646c5b..ada7df2331d20d088a75ffcc1c210aff69c99791 100644 --- a/net/ethtool/wol.c +++ b/net/ethtool/wol.c @@ -18,7 +18,8 @@ struct wol_reply_data { container_of(__reply_base, struct wol_reply_data, base) const struct nla_policy ethnl_wol_get_policy[] = { - [ETHTOOL_A_WOL_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_WOL_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), }; static int wol_prepare_data(const struct ethnl_req_info *req_base, @@ -96,7 +97,8 @@ const struct ethnl_request_ops ethnl_wol_request_ops = { /* WOL_SET */ const struct nla_policy ethnl_wol_set_policy[] = { - [ETHTOOL_A_WOL_HEADER] = { .type = NLA_NESTED }, + [ETHTOOL_A_WOL_HEADER] = + NLA_POLICY_NESTED(ethnl_header_policy), [ETHTOOL_A_WOL_MODES] = { .type = NLA_NESTED }, [ETHTOOL_A_WOL_SOPASS] = { .type = NLA_BINARY, .len = SOPASS_MAX },