Skip to content

Commit bc04358

Browse files
jmberg-inteldavem330
authored andcommitted
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>
1 parent 8140860 commit bc04358

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎drivers/net/macsec.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,7 @@ static const struct nla_policy macsec_genl_rxsc_policy[NUM_MACSEC_RXSC_ATTR] = {
16111611
static const struct nla_policy macsec_genl_sa_policy[NUM_MACSEC_SA_ATTR] = {
16121612
[MACSEC_SA_ATTR_AN] = { .type = NLA_U8 },
16131613
[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),
16151615
[MACSEC_SA_ATTR_KEYID] = { .type = NLA_BINARY,
16161616
.len = MACSEC_KEYID_LEN, },
16171617
[MACSEC_SA_ATTR_KEY] = { .type = NLA_BINARY,

‎drivers/net/wireguard/netlink.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = {
3434
[WGPEER_A_PUBLIC_KEY] = NLA_POLICY_EXACT_LEN(NOISE_PUBLIC_KEY_LEN),
3535
[WGPEER_A_PRESHARED_KEY] = NLA_POLICY_EXACT_LEN(NOISE_SYMMETRIC_KEY_LEN),
3636
[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)),
3838
[WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL] = { .type = NLA_U16 },
3939
[WGPEER_A_LAST_HANDSHAKE_TIME] = NLA_POLICY_EXACT_LEN(sizeof(struct __kernel_timespec)),
4040
[WGPEER_A_RX_BYTES] = { .type = NLA_U64 },
@@ -45,7 +45,7 @@ static const struct nla_policy peer_policy[WGPEER_A_MAX + 1] = {
4545

4646
static const struct nla_policy allowedip_policy[WGALLOWEDIP_A_MAX + 1] = {
4747
[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)),
4949
[WGALLOWEDIP_A_CIDR_MASK] = { .type = NLA_U8 }
5050
};
5151

‎net/wireless/nl80211.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,16 +701,16 @@ nl80211_wowlan_tcp_policy[NUM_NL80211_WOWLAN_TCP] = {
701701
[NL80211_WOWLAN_TCP_DST_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
702702
[NL80211_WOWLAN_TCP_SRC_PORT] = { .type = NLA_U16 },
703703
[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),
705705
[NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ] = {
706706
.len = sizeof(struct nl80211_wowlan_tcp_data_seq)
707707
},
708708
[NL80211_WOWLAN_TCP_DATA_PAYLOAD_TOKEN] = {
709709
.len = sizeof(struct nl80211_wowlan_tcp_data_token)
710710
},
711711
[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),
714714
};
715715
#endif /* CONFIG_PM */
716716

0 commit comments

Comments
 (0)