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:   Tue, 1 Nov 2022 16:24:47 +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: openrisc-randconfig-s033-20221101
compiler: or1k-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=openrisc SHELL=/bin/bash drivers/mmc/host/

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/mmc/host/sdhci.c:1909:31: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)
   drivers/mmc/host/sdhci.c:2433:41: sparse: sparse: cast truncates bits from constant value (ffff0001 becomes 1)

vim +1909 drivers/mmc/host/sdhci.c

52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1894  
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1895  u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock,
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1896  		   unsigned int *actual_clock)
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1897  {
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1898  	int div = 0; /* Initialized for compiler warning */
df16219f365f7f drivers/mmc/host/sdhci.c Giuseppe CAVALLARO          2011-11-04  1899  	int real_div = div, clk_mul = 1;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1900  	u16 clk = 0;
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1901  	bool switch_base_clk = false;
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1902  
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1903  	if (host->version >= SDHCI_SPEC_300) {
da91a8f9c0f56d drivers/mmc/host/sdhci.c Russell King                2014-04-25  1904  		if (host->preset_enabled) {
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1905  			u16 pre_val;
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1906  
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1907  			clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1908  			pre_val = sdhci_get_preset_value(host);
fa0910107a9fea drivers/mmc/host/sdhci.c Masahiro Yamada             2020-03-12 @1909  			div = FIELD_GET(SDHCI_PRESET_SDCLK_FREQ_MASK, pre_val);
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1910  			if (host->clk_mul &&
fa0910107a9fea drivers/mmc/host/sdhci.c Masahiro Yamada             2020-03-12  1911  				(pre_val & SDHCI_PRESET_CLKGEN_SEL)) {
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1912  				clk = SDHCI_PROG_CLOCK_MODE;
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1913  				real_div = div + 1;
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1914  				clk_mul = host->clk_mul;
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1915  			} else {
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1916  				real_div = max_t(int, 1, div << 1);
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1917  			}
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1918  			goto clock_set;
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1919  		}
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1920  
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1921  		/*
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1922  		 * Check if the Host Controller supports Programmable Clock
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1923  		 * Mode.
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1924  		 */
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1925  		if (host->clk_mul) {
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1926  			for (div = 1; div <= 1024; div++) {
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1927  				if ((host->max_clk * host->clk_mul / div)
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1928  					<= clock)
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1929  					break;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1930  			}
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1931  			if ((host->max_clk * host->clk_mul / div) <= clock) {
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1932  				/*
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1933  				 * Set Programmable Clock Mode in the Clock
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1934  				 * Control register.
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1935  				 */
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1936  				clk = SDHCI_PROG_CLOCK_MODE;
df16219f365f7f drivers/mmc/host/sdhci.c Giuseppe CAVALLARO          2011-11-04  1937  				real_div = div;
df16219f365f7f drivers/mmc/host/sdhci.c Giuseppe CAVALLARO          2011-11-04  1938  				clk_mul = host->clk_mul;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1939  				div--;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1940  			} else {
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1941  				/*
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1942  				 * Divisor can be too small to reach clock
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1943  				 * speed requirement. Then use the base clock.
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1944  				 */
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1945  				switch_base_clk = true;
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1946  			}
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1947  		}
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1948  
5497159c460fad drivers/mmc/host/sdhci.c ludovic.desroches@...el.com 2015-07-29  1949  		if (!host->clk_mul || switch_base_clk) {
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1950  			/* Version 3.00 divisors must be a multiple of 2. */
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1951  			if (host->max_clk <= clock)
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1952  				div = 1;
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1953  			else {
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1954  				for (div = 2; div < SDHCI_MAX_DIV_SPEC_300;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1955  				     div += 2) {
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1956  					if ((host->max_clk / div) <= clock)
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1957  						break;
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1958  				}
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1959  			}
df16219f365f7f drivers/mmc/host/sdhci.c Giuseppe CAVALLARO          2011-11-04  1960  			real_div = div;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1961  			div >>= 1;
d1955c3a9a1d89 drivers/mmc/host/sdhci.c Suneel Garapati             2015-06-09  1962  			if ((host->quirks2 & SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN)
d1955c3a9a1d89 drivers/mmc/host/sdhci.c Suneel Garapati             2015-06-09  1963  				&& !div && host->max_clk <= 25000000)
d1955c3a9a1d89 drivers/mmc/host/sdhci.c Suneel Garapati             2015-06-09  1964  				div = 1;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1965  		}
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1966  	} else {
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1967  		/* Version 2.00 divisors must be a power of 2. */
0397526d6ae251 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-09-20  1968  		for (div = 1; div < SDHCI_MAX_DIV_SPEC_200; div *= 2) {
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1969  			if ((host->max_clk / div) <= clock)
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1970  				break;
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1971  		}
df16219f365f7f drivers/mmc/host/sdhci.c Giuseppe CAVALLARO          2011-11-04  1972  		real_div = div;
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1973  		div >>= 1;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1974  	}
d129bceb1d44ed drivers/mmc/sdhci.c      Pierre Ossman               2006-03-24  1975  
52983382c74f59 drivers/mmc/host/sdhci.c Kevin Liu                   2013-01-31  1976  clock_set:
03d6f5ffc5c469 drivers/mmc/host/sdhci.c Aisheng Dong                2014-08-27  1977  	if (real_div)
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1978  		*actual_clock = (host->max_clk * clk_mul) / real_div;
c3ed3877625f10 drivers/mmc/host/sdhci.c Arindam Nath                2011-05-05  1979  	clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1980  	clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
85105c53b0ce70 drivers/mmc/host/sdhci.c Zhangfei Gao                2010-08-06  1981  		<< SDHCI_DIVIDER_HI_SHIFT;
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1982  
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1983  	return clk;
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1984  }
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1985  EXPORT_SYMBOL_GPL(sdhci_calc_clk);
fb9ee04779cf34 drivers/mmc/host/sdhci.c Ludovic Desroches           2016-04-07  1986  

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ