lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 11 Jun 2020 13:46:40 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Ryder Lee <ryder.lee@...iatek.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Felix Fietkau <nbd@....name>,
        Shayne Chen <shayne.chen@...iatek.com>,
        Chih-Min Chen <chih-min.chen@...iatek.com>
Subject: drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130
 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b29482fde649c72441d5478a4ea2c52c56d97a5e
commit: e57b7901469fc0b021930b83a8094baaf3d81b09 mt76: add mac80211 driver for MT7915 PCIe-based chipsets
config: x86_64-randconfig-m031-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

New smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e57b7901469fc0b021930b83a8094baaf3d81b09
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout e57b7901469fc0b021930b83a8094baaf3d81b09
vim +1130 drivers/net/wireless/mediatek/mt76/mt7915/mac.c

e57b7901469fc0 Ryder Lee 2020-04-25  1108  void mt7915_mac_sta_stats_work(struct work_struct *work)
e57b7901469fc0 Ryder Lee 2020-04-25  1109  {
e57b7901469fc0 Ryder Lee 2020-04-25  1110  	struct ieee80211_sta *sta;
e57b7901469fc0 Ryder Lee 2020-04-25  1111  	struct ieee80211_vif *vif;
e57b7901469fc0 Ryder Lee 2020-04-25  1112  	struct mt7915_sta_stats *stats;
e57b7901469fc0 Ryder Lee 2020-04-25  1113  	struct mt7915_sta *msta;
e57b7901469fc0 Ryder Lee 2020-04-25  1114  	struct mt7915_dev *dev;
e57b7901469fc0 Ryder Lee 2020-04-25  1115  
e57b7901469fc0 Ryder Lee 2020-04-25  1116  	msta = container_of(work, struct mt7915_sta, stats_work);
e57b7901469fc0 Ryder Lee 2020-04-25  1117  	sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
e57b7901469fc0 Ryder Lee 2020-04-25  1118  	vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv);
e57b7901469fc0 Ryder Lee 2020-04-25  1119  	dev = msta->vif->dev;
e57b7901469fc0 Ryder Lee 2020-04-25  1120  	stats = &msta->stats;
e57b7901469fc0 Ryder Lee 2020-04-25  1121  
e57b7901469fc0 Ryder Lee 2020-04-25  1122  	/* use MT_TX_FREE_RATE to report Tx rate for further devices */
e57b7901469fc0 Ryder Lee 2020-04-25  1123  	if (time_after(jiffies, stats->jiffies + HZ)) {
e57b7901469fc0 Ryder Lee 2020-04-25  1124  		mt7915_mcu_get_rate_info(dev, RATE_CTRL_RU_INFO,
e57b7901469fc0 Ryder Lee 2020-04-25  1125  					 msta->wcid.idx);
e57b7901469fc0 Ryder Lee 2020-04-25  1126  
e57b7901469fc0 Ryder Lee 2020-04-25  1127  		stats->jiffies = jiffies;
e57b7901469fc0 Ryder Lee 2020-04-25  1128  	}
e57b7901469fc0 Ryder Lee 2020-04-25  1129  
e57b7901469fc0 Ryder Lee 2020-04-25 @1130  	if (test_and_clear_bit(IEEE80211_RC_SUPP_RATES_CHANGED |
e57b7901469fc0 Ryder Lee 2020-04-25  1131  			       IEEE80211_RC_NSS_CHANGED |
e57b7901469fc0 Ryder Lee 2020-04-25  1132  			       IEEE80211_RC_BW_CHANGED, &stats->changed))

The test_and_clear_bit() takes a bit number like 1.  But this is
passing "(1 << 1) | ...".  It won't work at all.

e57b7901469fc0 Ryder Lee 2020-04-25  1133  		mt7915_mcu_add_rate_ctrl(dev, vif, sta);
e57b7901469fc0 Ryder Lee 2020-04-25  1134  
e57b7901469fc0 Ryder Lee 2020-04-25  1135  	if (test_and_clear_bit(IEEE80211_RC_SMPS_CHANGED, &stats->changed))
e57b7901469fc0 Ryder Lee 2020-04-25  1136  		mt7915_mcu_add_smps(dev, vif, sta);
e57b7901469fc0 Ryder Lee 2020-04-25  1137  
e57b7901469fc0 Ryder Lee 2020-04-25  1138  	spin_lock_bh(&dev->sta_poll_lock);
e57b7901469fc0 Ryder Lee 2020-04-25  1139  	if (list_empty(&msta->poll_list))
e57b7901469fc0 Ryder Lee 2020-04-25  1140  		list_add_tail(&msta->poll_list, &dev->sta_poll_list);
e57b7901469fc0 Ryder Lee 2020-04-25  1141  	spin_unlock_bh(&dev->sta_poll_lock);
e57b7901469fc0 Ryder Lee 2020-04-25  1142  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (37195 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ