]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: use BIT_ULL for NL80211_STA_INFO_* attribute types
authorOmer Efrat <omer.efrat@tandemg.com>
Mon, 18 Jun 2018 14:18:11 +0000 (17:18 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Jun 2018 13:08:56 +0000 (22:08 +0900)
The BIT macro uses unsigned long which some architectures handle as 32 bit
and therefore might cause macro's shift to overflow when used on a value
equals or larger than 32 (NL80211_STA_INFO_RX_DURATION and afterwards).

Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with all NL80211_STA_INFO_* attribute types instead of BIT
to prevent future possible bugs when one will use BIT macro for higher
attributes by mistake.

This commit cleans up all usages of BIT macro with the above field
in cfg80211 by changing it to BIT_ULL instead.

Signed-off-by: Omer Efrat <omer.efrat@tandemg.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
drivers/staging/wlan-ng/cfg80211.c

index 73fc3a742f74fd2b4e18f54272c56571b41f9819..af2234798fa8e18f4fd2dcff394e6a9d9343b2e8 100644 (file)
@@ -1266,16 +1266,16 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
                        goto exit;
                }
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
                sinfo->signal = translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
                sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS);
                sinfo->rx_packets = sta_rx_data_pkts(psta);
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
                sinfo->tx_packets = psta->sta_stats.tx_pkts;
 
        }
@@ -3006,7 +3006,7 @@ static int        cfg80211_rtw_dump_station(struct wiphy *wiphy, struct net_device *nde
                goto exit;
        }
        memcpy(mac, psta->hwaddr, ETH_ALEN);
-       sinfo->filled = BIT(NL80211_STA_INFO_SIGNAL);
+       sinfo->filled = BIT_ULL(NL80211_STA_INFO_SIGNAL);
        sinfo->signal = psta->rssi;
 
 exit:
index 1f09925b38df837f901b9b56be7094299d6cf87b..e96163f38e7bbab65b38b93151a81d6b35a8d3a5 100644 (file)
@@ -1141,7 +1141,7 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
                        return -ENOENT;
                }
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME);
 
                wilc_get_inactive_time(vif, mac, &inactive_time);
                sinfo->inactive_time = 1000 * inactive_time;
@@ -1150,11 +1150,11 @@ static int get_station(struct wiphy *wiphy, struct net_device *dev,
 
                wilc_get_statistics(vif, &stats, true);
 
-               sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
-                                BIT(NL80211_STA_INFO_RX_PACKETS) |
-                                BIT(NL80211_STA_INFO_TX_PACKETS) |
-                                BIT(NL80211_STA_INFO_TX_FAILED) |
-                                BIT(NL80211_STA_INFO_TX_BITRATE);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) |
+                                BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
+                                BIT_ULL(NL80211_STA_INFO_TX_PACKETS) |
+                                BIT_ULL(NL80211_STA_INFO_TX_FAILED) |
+                                BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
 
                sinfo->signal = stats.rssi;
                sinfo->rx_packets = stats.rx_cnt;
@@ -1775,7 +1775,7 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
        priv = wiphy_priv(wiphy);
        vif = netdev_priv(priv->dev);
 
-       sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+       sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
 
        wilc_get_rssi(vif, &sinfo->signal);
 
index 42912257e2b90f108e5ce788e3e04525a4e2982b..07c52e396387a9e529e059d996956d4a87c35ce1 100644 (file)
@@ -282,9 +282,9 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
 
        if (result == 0) {
                sinfo->txrate.legacy = quality.txrate.data;
-               sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
                sinfo->signal = quality.level.data;
-               sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
        }
 
        return result;