Commit 73fb2705 authored by Larry Finger's avatar Larry Finger Committed by Kalle Valo

rtlwifi: Fix size of wireless mode variable

Smatch reports the following warning:

  CHECK   drivers/net/wireless/realtek/rtlwifi/rc.c
drivers/net/wireless/realtek/rtlwifi/rc.c:144 _rtl_rc_rate_set_series() warn: impossible condition '(wireless_mode == 256) => (0-255 == 256)'

This warning arises because commit acc6907b87a9 ("rtlwifi: Fix warning
from ieee80211_get_tx_rates() when using 5G") now checks the wireless
mode for WIRELESS_MODE_AC_ONLY (BIT(8)) in _rtl_rc_rate_set_series().
As a result, all quantities used to store the wireless mode must be u16.

This patch also reorders struct rtl_sta_info to save a little space.

Fixes: d76d65fd ("rtlwifi: fix broken VHT support")
Reported-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 739596b0
...@@ -41,7 +41,7 @@ static u8 _rtl_rc_get_highest_rix(struct rtl_priv *rtlpriv, ...@@ -41,7 +41,7 @@ static u8 _rtl_rc_get_highest_rix(struct rtl_priv *rtlpriv,
struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_phy *rtlphy = &(rtlpriv->phy);
struct rtl_sta_info *sta_entry = NULL; struct rtl_sta_info *sta_entry = NULL;
u8 wireless_mode = 0; u16 wireless_mode = 0;
/* /*
*this rate is no use for true rate, firmware *this rate is no use for true rate, firmware
...@@ -99,7 +99,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv, ...@@ -99,7 +99,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv,
{ {
struct rtl_mac *mac = rtl_mac(rtlpriv); struct rtl_mac *mac = rtl_mac(rtlpriv);
struct rtl_sta_info *sta_entry = NULL; struct rtl_sta_info *sta_entry = NULL;
u8 wireless_mode = 0; u16 wireless_mode = 0;
u8 sgi_20 = 0, sgi_40 = 0, sgi_80 = 0; u8 sgi_20 = 0, sgi_40 = 0, sgi_80 = 0;
if (sta) { if (sta) {
......
...@@ -3837,7 +3837,7 @@ void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw) ...@@ -3837,7 +3837,7 @@ void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
u8 wireless_mode = mac->mode; u16 wireless_mode = mac->mode;
u8 sifs_timer, r2t_sifs; u8 sifs_timer, r2t_sifs;
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME,
......
...@@ -1318,14 +1318,13 @@ struct rtl_tid_data { ...@@ -1318,14 +1318,13 @@ struct rtl_tid_data {
struct rtl_sta_info { struct rtl_sta_info {
struct list_head list; struct list_head list;
u8 ratr_index;
u8 wireless_mode;
u8 mimo_ps;
u8 mac_addr[ETH_ALEN];
struct rtl_tid_data tids[MAX_TID_COUNT]; struct rtl_tid_data tids[MAX_TID_COUNT];
/* just used for ap adhoc or mesh*/ /* just used for ap adhoc or mesh*/
struct rssi_sta rssi_stat; struct rssi_sta rssi_stat;
u16 wireless_mode;
u8 ratr_index;
u8 mimo_ps;
u8 mac_addr[ETH_ALEN];
} __packed; } __packed;
struct rtl_priv; struct rtl_priv;
......
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