[linux-next:master 556/6237] drivers/net/wireless/ath/wcn36xx/main.c:409:7: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   763a906a02e961eedabab7dbedd16904a3bd0184
commit: d6f2746691cb10e484f15ab9e44e2cc2ccf9bd86 [556/6237] wcn36xx: Track the band and channel we are tuned to
config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220217/202202170554.WYrgcFtq-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0e628a783b935c70c80815db6c061ec84f884af5)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=d6f2746691cb10e484f15ab9e44e2cc2ccf9bd86
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout d6f2746691cb10e484f15ab9e44e2cc2ccf9bd86
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> drivers/net/wireless/ath/wcn36xx/main.c:409:7: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
                   if (channel)
                       ^
   drivers/net/wireless/ath/wcn36xx/main.c:396:2: note: 'channel' declared without an initial value
           struct ieee80211_channel *channel;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/wcn36xx/main.c:399:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < ARRAY_SIZE(wcn->hw->wiphy->bands); i++) {
           ^
   drivers/net/wireless/ath/wcn36xx/main.c:401:7: note: Assuming 'band' is non-null
                   if (!band)
                       ^~~~~
   drivers/net/wireless/ath/wcn36xx/main.c:401:3: note: Taking false branch
                   if (!band)
                   ^
   drivers/net/wireless/ath/wcn36xx/main.c:403:15: note: Assuming 'j' is >= field 'n_channels'
                   for (j = 0; j < band->n_channels; j++) {
                               ^~~~~~~~~~~~~~~~~~~~
   drivers/net/wireless/ath/wcn36xx/main.c:403:3: note: Loop condition is false. Execution continues on line 409
                   for (j = 0; j < band->n_channels; j++) {
                   ^
   drivers/net/wireless/ath/wcn36xx/main.c:409:7: note: Branch condition evaluates to a garbage value
                   if (channel)
                       ^~~~~~~
   drivers/net/wireless/ath/wcn36xx/main.c:413:6: warning: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch]
           if (!channel) {
               ^

vim +409 drivers/net/wireless/ath/wcn36xx/main.c

5973a2947430a29 Loic Poulain     2020-08-24  390
5973a2947430a29 Loic Poulain     2020-08-24  391  static void wcn36xx_change_opchannel(struct wcn36xx *wcn, int ch)
5973a2947430a29 Loic Poulain     2020-08-24  392  {
5973a2947430a29 Loic Poulain     2020-08-24  393  	struct ieee80211_vif *vif = NULL;
5973a2947430a29 Loic Poulain     2020-08-24  394  	struct wcn36xx_vif *tmp;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  395  	struct ieee80211_supported_band *band;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  396  	struct ieee80211_channel *channel;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  397  	int i, j;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  398
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  399  	for (i = 0; i < ARRAY_SIZE(wcn->hw->wiphy->bands); i++) {
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  400  		band = wcn->hw->wiphy->bands[i];
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  401  		if (!band)
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  402  			break;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  403  		for (j = 0; j < band->n_channels; j++) {
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  404  			if (HW_VALUE_CHANNEL(band->channels[j].hw_value) == ch) {
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  405  				channel = &band->channels[j];
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  406  				break;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  407  			}
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  408  		}
d6f2746691cb10e Bryan O'Donoghue 2022-01-15 @409  		if (channel)
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  410  			break;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  411  	}
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  412
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  413  	if (!channel) {
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  414  		wcn36xx_err("Cannot tune to channel %d\n", ch);
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  415  		return;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  416  	}
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  417
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  418  	wcn->band = band;
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  419  	wcn->channel = channel;
5973a2947430a29 Loic Poulain     2020-08-24  420
5973a2947430a29 Loic Poulain     2020-08-24  421  	list_for_each_entry(tmp, &wcn->vif_list, list) {
5973a2947430a29 Loic Poulain     2020-08-24  422  		vif = wcn36xx_priv_to_vif(tmp);
5973a2947430a29 Loic Poulain     2020-08-24  423  		wcn36xx_smd_switch_channel(wcn, vif, ch);
5973a2947430a29 Loic Poulain     2020-08-24  424  	}
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  425
d6f2746691cb10e Bryan O'Donoghue 2022-01-15  426  	return;
5973a2947430a29 Loic Poulain     2020-08-24  427  }
5973a2947430a29 Loic Poulain     2020-08-24  428

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux