developer | 7e32f7e | 2022-05-18 21:10:08 +0800 | [diff] [blame^] | 1 | From bc0435855041d7fff0b83dd992fc4be34aa11afb Mon Sep 17 00:00:00 2001 |
| 2 | From: Johannes Berg <johannes.berg@intel.com> |
| 3 | Date: Tue, 18 Aug 2020 10:17:32 +0200 |
| 4 | Subject: netlink: consistently use NLA_POLICY_MIN_LEN() |
| 5 | |
| 6 | Change places that open-code NLA_POLICY_MIN_LEN() to |
| 7 | use the macro instead, giving us flexibility in how we |
| 8 | handle the details of the macro. |
| 9 | |
| 10 | Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| 11 | Signed-off-by: David S. Miller <davem@davemloft.net> |
| 12 | --- |
| 13 | drivers/net/macsec.c | 2 +- |
| 14 | drivers/net/wireguard/netlink.c | 4 ++-- |
| 15 | net/wireless/nl80211.c | 6 +++--- |
| 16 | 3 files changed, 6 insertions(+), 6 deletions(-) |
| 17 | |
| 18 | --- a/drivers/net/macsec.c |
| 19 | +++ b/drivers/net/macsec.c |
| 20 | @@ -1608,7 +1608,7 @@ static const struct nla_policy macsec_ge |
| 21 | static const struct nla_policy macsec_genl_sa_policy[NUM_MACSEC_SA_ATTR] = { |
| 22 | [MACSEC_SA_ATTR_AN] = { .type = NLA_U8 }, |
| 23 | [MACSEC_SA_ATTR_ACTIVE] = { .type = NLA_U8 }, |
| 24 | - [MACSEC_SA_ATTR_PN] = { .type = NLA_MIN_LEN, .len = 4 }, |
| 25 | + [MACSEC_SA_ATTR_PN] = NLA_POLICY_MIN_LEN(4), |
| 26 | [MACSEC_SA_ATTR_KEYID] = { .type = NLA_BINARY, |
| 27 | .len = MACSEC_KEYID_LEN, }, |
| 28 | [MACSEC_SA_ATTR_KEY] = { .type = NLA_BINARY, |
| 29 | --- a/net/wireless/nl80211.c |
| 30 | +++ b/net/wireless/nl80211.c |
| 31 | @@ -676,7 +676,7 @@ nl80211_wowlan_tcp_policy[NUM_NL80211_WO |
| 32 | }, |
| 33 | [NL80211_WOWLAN_TCP_SRC_PORT] = { .type = NLA_U16 }, |
| 34 | [NL80211_WOWLAN_TCP_DST_PORT] = { .type = NLA_U16 }, |
| 35 | - [NL80211_WOWLAN_TCP_DATA_PAYLOAD] = { .type = NLA_MIN_LEN, .len = 1 }, |
| 36 | + [NL80211_WOWLAN_TCP_DATA_PAYLOAD] = NLA_POLICY_MIN_LEN(1), |
| 37 | [NL80211_WOWLAN_TCP_DATA_PAYLOAD_SEQ] = { |
| 38 | .len = sizeof(struct nl80211_wowlan_tcp_data_seq) |
| 39 | }, |
| 40 | @@ -684,8 +684,8 @@ nl80211_wowlan_tcp_policy[NUM_NL80211_WO |
| 41 | .len = sizeof(struct nl80211_wowlan_tcp_data_token) |
| 42 | }, |
| 43 | [NL80211_WOWLAN_TCP_DATA_INTERVAL] = { .type = NLA_U32 }, |
| 44 | - [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = { .type = NLA_MIN_LEN, .len = 1 }, |
| 45 | - [NL80211_WOWLAN_TCP_WAKE_MASK] = { .type = NLA_MIN_LEN, .len = 1 }, |
| 46 | + [NL80211_WOWLAN_TCP_WAKE_PAYLOAD] = NLA_POLICY_MIN_LEN(1), |
| 47 | + [NL80211_WOWLAN_TCP_WAKE_MASK] = NLA_POLICY_MIN_LEN(1), |
| 48 | }; |
| 49 | #endif /* CONFIG_PM */ |
| 50 | |