Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netlink: consistently use NLA_POLICY_MIN_LEN()

Change places that open-code NLA_POLICY_MIN_LEN() to
use the macro instead, giving us flexibility in how we
handle the details of the macro.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Johannes Berg and committed by
David S. Miller
bc043585 8140860c

+6 -6
+1 -1
drivers/net/macsec.c
··· 1611 1611 static const struct nla_policy macsec_genl_sa_policy[NUM_MACSEC_SA_ATTR] = { 1612 1612 [MACSEC_SA_ATTR_AN] = { .type = NLA_U8 }, 1613 1613 [MACSEC_SA_ATTR_ACTIVE] = { .type = NLA_U8 }, 1614 - [MACSEC_SA_ATTR_PN] = { .type = NLA_MIN_LEN, .len = 4 }, 1614 + [MACSEC_SA_ATTR_PN] = NLA_POLICY_MIN_LEN(4), 1615 1615 [MACSEC_SA_ATTR_KEYID] = { .type = NLA_BINARY, 1616 1616 .len = MACSEC_KEYID_LEN, }, 1617 1617 [MACSEC_SA_ATTR_KEY] = { .type = NLA_BINARY,
+2 -2
drivers/net/wireguard/netlink.c
··· 34 34 [WGPEER_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN), 35 35 [WGPEER_A_PRESHARED_KEY] = NLA_POLICY_EXACT_LEN(NOISE_SYMMETRIC_KEY_LEN), 36 36 [WGPEER_A_FLAGS] = { .type = NLA_U32 }, 37 - [WGPEER_A_ENDPOINT] = { .type = NLA_MIN_LEN, .len = sizeof(struct sockaddr) }, 37 + [WGPEER_A_ENDPOINT] = NLA_POLICY_MIN_LEN(sizeof(struct sockaddr)), 38 38 [WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL] = { .type = NLA_U16 }, 39 39 [WGPEER_A_LAST_HANDSHAKE_TIME] = NLA_POLICY_EXACT_LEN(sizeof(struct __kernel_timespec)), 40 40 [WGPEER_A_RX_BYTES] = { .type = NLA_U64 }, ··· 45 45 46 46 static const struct nla_policy allowedip_policy[WGALLOWEDIP_A_MAX + 1] = { 47 47 [WGALLOWEDIP_A_FAMILY] = { .type = NLA_U16 }, 48 - [WGALLOWEDIP_A_IPADDR] = { .type = NLA_MIN_LEN, .len = sizeof(struct in_addr) }, 48 + [WGALLOWEDIP_A_IPADDR] = NLA_POLICY_MIN_LEN(sizeof(struct in_addr)), 49 49 [WGALLOWEDIP_A_CIDR_MASK] = { .type = NLA_U8 } 50 50 }; 51 51
+3 -3
net/wireless/nl80211.c
··· 701 701 [NL80211_WOWLAN_TCP_DST_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN), 702 702 [NL80211_WOWLAN_TCP_SRC_PORT] = { .type = NLA_U16 }, 703 703 [NL80211_WOWLAN_TCP_DST_PORT] = { .type = NLA_U16 }, 704 - [NL80211_WOWLAN_TCP_DATA_PAYLOAD] = { .type = NLA_MIN_LEN, .len = 1 }, 704 + [NL80211_WOWLAN_TCP_DATA_PAYLOAD] = NLA_POLICY_MIN_LEN(1), 705 705 [NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ] = { 706 706 .len = sizeof(struct nl80211_wowlan_tcp_data_seq) 707 707 }, ··· 709 709 .len = sizeof(struct nl80211_wowlan_tcp_data_token) 710 710 }, 711 711 [NL80211_WOWLAN_TCP_DATA_INTERVAL] = { .type = NLA_U32 }, 712 - [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = { .type = NLA_MIN_LEN, .len = 1 }, 713 - [NL80211_WOWLAN_TCP_WAKE_MASK] = { .type = NLA_MIN_LEN, .len = 1 }, 712 + [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = NLA_POLICY_MIN_LEN(1), 713 + [NL80211_WOWLAN_TCP_WAKE_MASK] = NLA_POLICY_MIN_LEN(1), 714 714 }; 715 715 #endif /* CONFIG_PM */ 716 716