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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 2 Nov 2022 06:13:55 +0800
From:   kernel test robot <lkp@...el.com>
To:     Gwan-gyeong Mun <gwan-gyeong.mun@...el.com>,
        ndesaulniers@...gle.com
Cc:     oe-kbuild-all@...ts.linux.dev, peterz@...radead.org,
        llvm@...ts.linux.dev, ashutosh.dixit@...el.com,
        andi.shyti@...ux.intel.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bitfield: Use argument type for size comparison on
 Bitfield access macros

Hi Gwan-gyeong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.1-rc3 next-20221101]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Gwan-gyeong-Mun/bitfield-Use-argument-type-for-size-comparison-on-Bitfield-access-macros/20221029-133640
patch link:    https://lore.kernel.org/r/20221029053429.38381-1-gwan-gyeong.mun%40intel.com
patch subject: [PATCH] bitfield: Use argument type for size comparison on Bitfield access macros
config: csky-randconfig-s031-20221031
compiler: csky-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/91f22fce5cc0639c001bcf755c9dec0913073876
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Gwan-gyeong-Mun/bitfield-Use-argument-type-for-size-comparison-on-Bitfield-access-macros/20221029-133640
        git checkout 91f22fce5cc0639c001bcf755c9dec0913073876
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash drivers/iio/dac/ drivers/net/wireless/mediatek/mt76/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/iio/dac/ad7293.c:468:16: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   drivers/iio/dac/ad7293.c:524:40: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
--
   drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c: note: in included file:
>> drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h:1668:39: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h:1669:39: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
>> drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:2728:28: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c:2729:28: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
>> drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h:1650:16: sparse: sparse: cast truncates bits from constant value (ffffff01 becomes 1)
--
   drivers/net/wireless/mediatek/mt76/mt7615/mcu.c: note: in included file (through drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h):
>> drivers/net/wireless/mediatek/mt76/mt7615/../mt76_connac_mcu.h:1650:16: sparse: sparse: cast truncates bits from constant value (ffffff01 becomes 1)

vim +468 drivers/iio/dac/ad7293.c

0bb12606c05fe9 Antoniu Miclaus 2021-12-02  404  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  405  static int ad7293_ch_read_raw(struct ad7293_state *st, enum ad7293_ch_type type,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  406  			      unsigned int ch, u16 *raw)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  407  {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  408  	int ret;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  409  	unsigned int reg_wr, reg_rd, data_wr;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  410  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  411  	switch (type) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  412  	case AD7293_ADC_VINX:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  413  		reg_wr = AD7293_REG_VINX_SEQ;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  414  		reg_rd = AD7293_REG_VIN0 + ch;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  415  		data_wr = BIT(ch);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  416  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  417  		break;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  418  	case AD7293_ADC_TSENSE:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  419  		reg_wr = AD7293_REG_ISENSEX_TSENSEX_SEQ;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  420  		reg_rd = AD7293_REG_TSENSE_INT + ch;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  421  		data_wr = BIT(ch);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  422  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  423  		break;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  424  	case AD7293_ADC_ISENSE:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  425  		reg_wr = AD7293_REG_ISENSEX_TSENSEX_SEQ;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  426  		reg_rd = AD7293_REG_ISENSE_0 + ch;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  427  		data_wr = BIT(ch) << 8;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  428  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  429  		break;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  430  	case AD7293_DAC:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  431  		reg_rd = AD7293_REG_UNI_VOUT0 + ch;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  432  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  433  		break;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  434  	default:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  435  		return -EINVAL;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  436  	}
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  437  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  438  	mutex_lock(&st->lock);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  439  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  440  	if (type != AD7293_DAC) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  441  		if (type == AD7293_ADC_TSENSE) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  442  			ret = __ad7293_spi_write(st, AD7293_REG_TSENSE_BG_EN,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  443  						 BIT(ch));
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  444  			if (ret)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  445  				goto exit;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  446  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  447  			usleep_range(9000, 9900);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  448  		} else if (type == AD7293_ADC_ISENSE) {
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  449  			ret = __ad7293_spi_write(st, AD7293_REG_ISENSE_BG_EN,
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  450  						 BIT(ch));
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  451  			if (ret)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  452  				goto exit;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  453  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  454  			usleep_range(2000, 7000);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  455  		}
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  456  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  457  		ret = __ad7293_spi_write(st, reg_wr, data_wr);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  458  		if (ret)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  459  			goto exit;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  460  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  461  		ret = __ad7293_spi_write(st, AD7293_REG_CONV_CMD, 0x82);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  462  		if (ret)
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  463  			goto exit;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  464  	}
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  465  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  466  	ret = __ad7293_spi_read(st, reg_rd, raw);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  467  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02 @468  	*raw = FIELD_GET(AD7293_REG_DATA_RAW_MSK, *raw);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  469  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  470  exit:
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  471  	mutex_unlock(&st->lock);
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  472  
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  473  	return ret;
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  474  }
0bb12606c05fe9 Antoniu Miclaus 2021-12-02  475  

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ