Commit 2dad624e authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

wireless: use nla_put_u64_64bit()

Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbdeafd7
...@@ -2197,6 +2197,8 @@ enum nl80211_attrs { ...@@ -2197,6 +2197,8 @@ enum nl80211_attrs {
NL80211_ATTR_STA_SUPPORT_P2P_PS, NL80211_ATTR_STA_SUPPORT_P2P_PS,
NL80211_ATTR_PAD,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST, __NL80211_ATTR_AFTER_LAST,
...@@ -3023,6 +3025,7 @@ enum nl80211_survey_info { ...@@ -3023,6 +3025,7 @@ enum nl80211_survey_info {
NL80211_SURVEY_INFO_TIME_RX, NL80211_SURVEY_INFO_TIME_RX,
NL80211_SURVEY_INFO_TIME_TX, NL80211_SURVEY_INFO_TIME_TX,
NL80211_SURVEY_INFO_TIME_SCAN, NL80211_SURVEY_INFO_TIME_SCAN,
NL80211_SURVEY_INFO_PAD,
/* keep last */ /* keep last */
__NL80211_SURVEY_INFO_AFTER_LAST, __NL80211_SURVEY_INFO_AFTER_LAST,
...@@ -3468,6 +3471,7 @@ enum nl80211_bss { ...@@ -3468,6 +3471,7 @@ enum nl80211_bss {
NL80211_BSS_BEACON_TSF, NL80211_BSS_BEACON_TSF,
NL80211_BSS_PRESP_DATA, NL80211_BSS_PRESP_DATA,
NL80211_BSS_LAST_SEEN_BOOTTIME, NL80211_BSS_LAST_SEEN_BOOTTIME,
NL80211_BSS_PAD,
/* keep last */ /* keep last */
__NL80211_BSS_AFTER_LAST, __NL80211_BSS_AFTER_LAST,
......
...@@ -2429,7 +2429,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag ...@@ -2429,7 +2429,8 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, wdev_address(wdev)) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, wdev_address(wdev)) ||
nla_put_u32(msg, NL80211_ATTR_GENERATION, nla_put_u32(msg, NL80211_ATTR_GENERATION,
rdev->devlist_generation ^ rdev->devlist_generation ^
...@@ -6874,7 +6875,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -6874,7 +6875,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
if (wdev->netdev && if (wdev->netdev &&
nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex)) nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) if (nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
bss = nla_nest_start(msg, NL80211_ATTR_BSS); bss = nla_nest_start(msg, NL80211_ATTR_BSS);
...@@ -6895,7 +6897,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -6895,7 +6897,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
*/ */
ies = rcu_dereference(res->ies); ies = rcu_dereference(res->ies);
if (ies) { if (ies) {
if (nla_put_u64(msg, NL80211_BSS_TSF, ies->tsf)) if (nla_put_u64_64bit(msg, NL80211_BSS_TSF, ies->tsf,
NL80211_BSS_PAD))
goto fail_unlock_rcu; goto fail_unlock_rcu;
if (ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS, if (ies->len && nla_put(msg, NL80211_BSS_INFORMATION_ELEMENTS,
ies->len, ies->data)) ies->len, ies->data))
...@@ -6905,7 +6908,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -6905,7 +6908,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
/* and this pointer is always (unless driver didn't know) beacon data */ /* and this pointer is always (unless driver didn't know) beacon data */
ies = rcu_dereference(res->beacon_ies); ies = rcu_dereference(res->beacon_ies);
if (ies && ies->from_beacon) { if (ies && ies->from_beacon) {
if (nla_put_u64(msg, NL80211_BSS_BEACON_TSF, ies->tsf)) if (nla_put_u64_64bit(msg, NL80211_BSS_BEACON_TSF, ies->tsf,
NL80211_BSS_PAD))
goto fail_unlock_rcu; goto fail_unlock_rcu;
if (ies->len && nla_put(msg, NL80211_BSS_BEACON_IES, if (ies->len && nla_put(msg, NL80211_BSS_BEACON_IES,
ies->len, ies->data)) ies->len, ies->data))
...@@ -6924,8 +6928,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, ...@@ -6924,8 +6928,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb,
goto nla_put_failure; goto nla_put_failure;
if (intbss->ts_boottime && if (intbss->ts_boottime &&
nla_put_u64(msg, NL80211_BSS_LAST_SEEN_BOOTTIME, nla_put_u64_64bit(msg, NL80211_BSS_LAST_SEEN_BOOTTIME,
intbss->ts_boottime)) intbss->ts_boottime, NL80211_BSS_PAD))
goto nla_put_failure; goto nla_put_failure;
switch (rdev->wiphy.signal_type) { switch (rdev->wiphy.signal_type) {
...@@ -7045,28 +7049,28 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq, ...@@ -7045,28 +7049,28 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq,
nla_put_flag(msg, NL80211_SURVEY_INFO_IN_USE)) nla_put_flag(msg, NL80211_SURVEY_INFO_IN_USE))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME) && if ((survey->filled & SURVEY_INFO_TIME) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME,
survey->time)) survey->time, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME_BUSY) && if ((survey->filled & SURVEY_INFO_TIME_BUSY) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_BUSY, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_BUSY,
survey->time_busy)) survey->time_busy, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME_EXT_BUSY) && if ((survey->filled & SURVEY_INFO_TIME_EXT_BUSY) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_EXT_BUSY, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_EXT_BUSY,
survey->time_ext_busy)) survey->time_ext_busy, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME_RX) && if ((survey->filled & SURVEY_INFO_TIME_RX) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_RX, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_RX,
survey->time_rx)) survey->time_rx, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME_TX) && if ((survey->filled & SURVEY_INFO_TIME_TX) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_TX, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_TX,
survey->time_tx)) survey->time_tx, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
if ((survey->filled & SURVEY_INFO_TIME_SCAN) && if ((survey->filled & SURVEY_INFO_TIME_SCAN) &&
nla_put_u64(msg, NL80211_SURVEY_INFO_TIME_SCAN, nla_put_u64_64bit(msg, NL80211_SURVEY_INFO_TIME_SCAN,
survey->time_scan)) survey->time_scan, NL80211_SURVEY_INFO_PAD))
goto nla_put_failure; goto nla_put_failure;
nla_nest_end(msg, infoattr); nla_nest_end(msg, infoattr);
...@@ -7786,8 +7790,8 @@ __cfg80211_alloc_vendor_skb(struct cfg80211_registered_device *rdev, ...@@ -7786,8 +7790,8 @@ __cfg80211_alloc_vendor_skb(struct cfg80211_registered_device *rdev,
} }
if (wdev) { if (wdev) {
if (nla_put_u64(skb, NL80211_ATTR_WDEV, if (nla_put_u64_64bit(skb, NL80211_ATTR_WDEV,
wdev_id(wdev))) wdev_id(wdev), NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
if (wdev->netdev && if (wdev->netdev &&
nla_put_u32(skb, NL80211_ATTR_IFINDEX, nla_put_u32(skb, NL80211_ATTR_IFINDEX,
...@@ -8380,7 +8384,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb, ...@@ -8380,7 +8384,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
if (err) if (err)
goto free_msg; goto free_msg;
if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
...@@ -8792,7 +8797,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) ...@@ -8792,7 +8797,8 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
goto free_msg; goto free_msg;
if (msg) { if (msg) {
if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
...@@ -10078,7 +10084,8 @@ static int nl80211_probe_client(struct sk_buff *skb, ...@@ -10078,7 +10084,8 @@ static int nl80211_probe_client(struct sk_buff *skb,
if (err) if (err)
goto free_msg; goto free_msg;
if (nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
...@@ -10503,8 +10510,9 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb, ...@@ -10503,8 +10510,9 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
break; break;
if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(wdev && nla_put_u64(skb, NL80211_ATTR_WDEV, (wdev && nla_put_u64_64bit(skb, NL80211_ATTR_WDEV,
wdev_id(wdev)))) { wdev_id(wdev),
NL80211_ATTR_PAD))) {
genlmsg_cancel(skb, hdr); genlmsg_cancel(skb, hdr);
break; break;
} }
...@@ -11711,7 +11719,8 @@ static int nl80211_send_scan_msg(struct sk_buff *msg, ...@@ -11711,7 +11719,8 @@ static int nl80211_send_scan_msg(struct sk_buff *msg,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
wdev->netdev->ifindex)) || wdev->netdev->ifindex)) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
/* ignore errors and send incomplete event anyway */ /* ignore errors and send incomplete event anyway */
...@@ -12378,11 +12387,13 @@ static void nl80211_send_remain_on_chan_event( ...@@ -12378,11 +12387,13 @@ static void nl80211_send_remain_on_chan_event(
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
wdev->netdev->ifindex)) || wdev->netdev->ifindex)) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
NL80211_CHAN_NO_HT) || NL80211_CHAN_NO_HT) ||
nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL && if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL &&
...@@ -12616,7 +12627,8 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, ...@@ -12616,7 +12627,8 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, (netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
netdev->ifindex)) || netdev->ifindex)) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) || nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
(sig_dbm && (sig_dbm &&
nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) || nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
...@@ -12659,9 +12671,11 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, ...@@ -12659,9 +12671,11 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, (netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
netdev->ifindex)) || netdev->ifindex)) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) ||
nla_put(msg, NL80211_ATTR_FRAME, len, buf) || nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie) || nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD) ||
(ack && nla_put_flag(msg, NL80211_ATTR_ACK))) (ack && nla_put_flag(msg, NL80211_ATTR_ACK)))
goto nla_put_failure; goto nla_put_failure;
...@@ -13041,7 +13055,8 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev, ...@@ -13041,7 +13055,8 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev,
struct wireless_dev *wdev = netdev->ieee80211_ptr; struct wireless_dev *wdev = netdev->ieee80211_ptr;
if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
} }
...@@ -13086,7 +13101,8 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, ...@@ -13086,7 +13101,8 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) ||
nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) ||
nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie) || nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
NL80211_ATTR_PAD) ||
(acked && nla_put_flag(msg, NL80211_ATTR_ACK))) (acked && nla_put_flag(msg, NL80211_ATTR_ACK)))
goto nla_put_failure; goto nla_put_failure;
...@@ -13231,7 +13247,8 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev, ...@@ -13231,7 +13247,8 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
goto free_msg; goto free_msg;
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto free_msg; goto free_msg;
if (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, if (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
...@@ -13506,7 +13523,8 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) ...@@ -13506,7 +13523,8 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto nla_put_failure; goto nla_put_failure;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
...@@ -13539,7 +13557,8 @@ void nl80211_send_ap_stopped(struct wireless_dev *wdev) ...@@ -13539,7 +13557,8 @@ void nl80211_send_ap_stopped(struct wireless_dev *wdev)
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) || nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) ||
nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD))
goto out; goto out;
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment