From patchwork Thu Feb 25 17:03:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 8425191 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B84919F372 for ; Thu, 25 Feb 2016 17:03:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB304202D1 for ; Thu, 25 Feb 2016 17:03:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A905B20270 for ; Thu, 25 Feb 2016 17:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933216AbcBYRDK (ORCPT ); Thu, 25 Feb 2016 12:03:10 -0500 Received: from mail-ob0-f182.google.com ([209.85.214.182]:32946 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933151AbcBYRDI (ORCPT ); Thu, 25 Feb 2016 12:03:08 -0500 Received: by mail-ob0-f182.google.com with SMTP id jq7so53703523obb.0 for ; Thu, 25 Feb 2016 09:03:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=w1ka10jIa/gpVzOwWhTeqFdXGA0c/0NhzJckMmvavDg=; b=rxPGQ84dk6O0P+PCvAeuoPGejGL3btBlyleKd552epTarOne3X9EOa0LvCg4XW/VdP 3qwoMp6ugoq6qnHA+ytS+GzTkjyBTjPl0EYazEt9fpyMI9evOevJsqfNnqUoRw249pmo dnb00BfzVqwy8D0uo4T3NAo42A7on6WiUf+Fvjhq3srrV9C078las0o9bppSXlCoELz4 KfWwjLJdRIQZslUAGiEJj3ymQg4CxIEk1kym1xsizGO5XWmtCq9ofHGV3GoghSVg6k8/ IGhrPMtZAgOZc623r6lOLNzZAAN1axybd03OQ5wE/wLDGjy6tCLP1P4bKlnjqZ4jRJn4 Lfow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=w1ka10jIa/gpVzOwWhTeqFdXGA0c/0NhzJckMmvavDg=; b=JoAnQR76KejW0OiXzHHzG89Q00VR7W3Yg0H6AgOhDRT7ibusxcvb4AapOkfKXbxfYX 501FANiPh1nPJzDWQAxEjkpta6QXcbPzijR/ShSmBEdQMismF7R1R6eGTXpHFTKjAXJ/ 311GEe1o/T12DTEveDWEx1t10wGHO1MEGfIs653c+r8IhjbI5kRMI4dnBVzPClOpREQ/ dRse1KYL9kx1JxlR91jSDuE4VSuxVLr5D8hhvwowPZvjKEGE7eXS3RoejX+nCOCVJm12 rXIvsmaGpSk+J4IY0f3KQVk+tf7eF2dGewgOraqnHxmr5P16UQwI3ixlaNLO2Tt5P5Me T6IA== X-Gm-Message-State: AG10YOSiVimyfmXRTTvVfAvPan61Pftq3lKPRwgWGz+raYh67mZRNNk+4OIs/9yhaiUpPA== X-Received: by 10.60.101.132 with SMTP id fg4mr33097342oeb.21.1456419787746; Thu, 25 Feb 2016 09:03:07 -0800 (PST) Received: from linux.site (cpe-24-31-249-175.kc.res.rr.com. [24.31.249.175]) by smtp.gmail.com with ESMTPSA id bi2sm5809244obb.24.2016.02.25.09.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Feb 2016 09:03:06 -0800 (PST) From: Larry Finger To: kvalo@codeaurora.org Cc: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org, Larry Finger Subject: [PATCH] rtlwifi: Fix size of wireless mode variable Date: Thu, 25 Feb 2016 11:03:01 -0600 Message-Id: <1456419781-14722-1-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: commit acc6907b87a9 ("rtlwifi: Fix warning from ieee80211_get_tx_rates() when using 5G") Reported-by: Dan Williams Signed-off-by: Larry Finger --- drivers/net/wireless/realtek/rtlwifi/rc.c | 4 ++-- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 2 +- drivers/net/wireless/realtek/rtlwifi/wifi.h | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c index 28f7010..1aca777 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rc.c +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c @@ -41,7 +41,7 @@ static u8 _rtl_rc_get_highest_rix(struct rtl_priv *rtlpriv, struct rtl_hal *rtlhal = rtl_hal(rtlpriv); struct rtl_phy *rtlphy = &(rtlpriv->phy); struct rtl_sta_info *sta_entry = NULL; - u8 wireless_mode = 0; + u16 wireless_mode = 0; /* *this rate is no use for true rate, firmware @@ -99,7 +99,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv, { struct rtl_mac *mac = rtl_mac(rtlpriv); 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; if (sta) { diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c index 5da9bd0..fe900ba 100644 --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c @@ -3837,7 +3837,7 @@ void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = 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; rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h index b07b364..554d814 100644 --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -1318,14 +1318,13 @@ struct rtl_tid_data { struct rtl_sta_info { 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]; - /* just used for ap adhoc or mesh*/ struct rssi_sta rssi_stat; + u16 wireless_mode; + u8 ratr_index; + u8 mimo_ps; + u8 mac_addr[ETH_ALEN]; } __packed; struct rtl_priv;