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]
Message-ID: <202210012217.M1j2gtaN-lkp@intel.com>
Date:   Sat, 1 Oct 2022 22:55:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Felix Fietkau <nbd@....name>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [nbd168-wireless:mt76 2/16]
 drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c:65:56: warning: array
 subscript 8 is above array bounds of 's8[2]' {aka 'signed char[2]'}

tree:   https://github.com/nbd168/wireless mt76
head:   89a6673473289dae43a1c15769930d4ac869d5a8
commit: 89a6673473289dae43a1c15769930d4ac869d5a8 [2/16] wifi: mt76: mt76x02: simplify struct mt76x02_rate_power
config: x86_64-allyesconfig
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/nbd168/wireless/commit/89a6673473289dae43a1c15769930d4ac869d5a8
        git remote add nbd168-wireless https://github.com/nbd168/wireless
        git fetch --no-tags nbd168-wireless mt76
        git checkout 89a6673473289dae43a1c15769930d4ac869d5a8
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c: In function 'mt76x02_tx_get_max_txpwr_adj':
>> drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c:65:56: warning: array subscript 8 is above array bounds of 's8[2]' {aka 'signed char[2]'} [-Warray-bounds]
      65 |                         max_txpwr = dev->rate_power.vht[8];
         |                                     ~~~~~~~~~~~~~~~~~~~^~~
   In file included from drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c:9:
   drivers/net/wireless/mediatek/mt76/mt76x02.h:81:28: note: while referencing 'vht'
      81 |                         s8 vht[2];
         |                            ^~~


vim +65 drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c

8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  55  
91be8e8a2c4f72 Lorenzo Bianconi 2018-10-07  56  s8 mt76x02_tx_get_max_txpwr_adj(struct mt76x02_dev *dev,
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  57  				const struct ieee80211_tx_rate *rate)
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  58  {
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  59  	s8 max_txpwr;
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  60  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  61  	if (rate->flags & IEEE80211_TX_RC_VHT_MCS) {
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  62  		u8 mcs = ieee80211_rate_get_vht_mcs(rate);
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  63  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  64  		if (mcs == 8 || mcs == 9) {
9c373cf071ff68 Felix Fietkau    2022-09-28 @65  			max_txpwr = dev->rate_power.vht[8];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  66  		} else {
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  67  			u8 nss, idx;
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  68  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  69  			nss = ieee80211_rate_get_vht_nss(rate);
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  70  			idx = ((nss - 1) << 3) + mcs;
9c373cf071ff68 Felix Fietkau    2022-09-28  71  			max_txpwr = dev->rate_power.ht[idx & 0xf];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  72  		}
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  73  	} else if (rate->flags & IEEE80211_TX_RC_MCS) {
9c373cf071ff68 Felix Fietkau    2022-09-28  74  		max_txpwr = dev->rate_power.ht[rate->idx & 0xf];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  75  	} else {
96747a51fe62eb Felix Fietkau    2019-10-12  76  		enum nl80211_band band = dev->mphy.chandef.chan->band;
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  77  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  78  		if (band == NL80211_BAND_2GHZ) {
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  79  			const struct ieee80211_rate *r;
91be8e8a2c4f72 Lorenzo Bianconi 2018-10-07  80  			struct wiphy *wiphy = dev->mt76.hw->wiphy;
9c373cf071ff68 Felix Fietkau    2022-09-28  81  			struct mt76x02_rate_power *rp = &dev->rate_power;
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  82  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  83  			r = &wiphy->bands[band]->bitrates[rate->idx];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  84  			if (r->flags & IEEE80211_RATE_SHORT_PREAMBLE)
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  85  				max_txpwr = rp->cck[r->hw_value & 0x3];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  86  			else
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  87  				max_txpwr = rp->ofdm[r->hw_value & 0x7];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  88  		} else {
9c373cf071ff68 Felix Fietkau    2022-09-28  89  			max_txpwr = dev->rate_power.ofdm[rate->idx & 0x7];
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  90  		}
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  91  	}
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  92  
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  93  	return max_txpwr;
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  94  }
8e3ed0017bdd86 Lorenzo Bianconi 2018-10-05  95  

:::::: The code at line 65 was first introduced by commit
:::::: 9c373cf071ff685613a4be643f52188c797d05f8 wifi: mt76: move mt76_rate_power from core to mt76x02 driver code

:::::: TO: Felix Fietkau <nbd@....name>
:::::: CC: Felix Fietkau <nbd@....name>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (289494 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ