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: <202312060952.zRI5dp2r-lkp@intel.com>
Date:   Wed, 6 Dec 2023 10:05:02 +0800
From:   kernel test robot <lkp@...el.com>
To:     Krzysztof Kozlowski <krzk@...nel.org>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: drivers/memory/brcmstb_dpfe.c:521:29: sparse: sparse: cast to
 restricted __be32

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   bee0e7762ad2c6025b9f5245c040fcc36ef2bde8
commit: 904ffa81b709f79b906077e72f4656bdb9930340 memory: brcmstb_dpfe: add separate entry for compile test
date:   3 years, 4 months ago
config: openrisc-randconfig-r131-20231102 (https://download.01.org/0day-ci/archive/20231206/202312060952.zRI5dp2r-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231206/202312060952.zRI5dp2r-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312060952.zRI5dp2r-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/memory/brcmstb_dpfe.c:521:29: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:522:29: sparse: sparse: cast to restricted __be32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
>> drivers/memory/brcmstb_dpfe.c:524:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:525:29: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:46: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:548:19: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:565:25: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:566:28: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:567:27: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:569:25: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:570:28: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:571:27: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:600:40: sparse: sparse: cast to restricted __be32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c:603:40: sparse: sparse: cast to restricted __le32
   drivers/memory/brcmstb_dpfe.c: note: in included file (through arch/openrisc/include/asm/io.h, include/linux/io.h):
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:299:22: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] value @@     got restricted __le32 [usertype] @@
   include/asm-generic/io.h:299:22: sparse:     expected unsigned int [usertype] value
   include/asm-generic/io.h:299:22: sparse:     got restricted __le32 [usertype]
   include/asm-generic/io.h:267:16: sparse: sparse: cast to restricted __le32

vim +521 drivers/memory/brcmstb_dpfe.c

2f330caff57762 Markus Mayer 2017-08-24  505  
2f330caff57762 Markus Mayer 2017-08-24  506  /* Ensure that the firmware file loaded meets all the requirements. */
2f330caff57762 Markus Mayer 2017-08-24  507  static int __verify_firmware(struct init_data *init,
2f330caff57762 Markus Mayer 2017-08-24  508  			     const struct firmware *fw)
2f330caff57762 Markus Mayer 2017-08-24  509  {
2f330caff57762 Markus Mayer 2017-08-24  510  	const struct dpfe_firmware_header *header = (void *)fw->data;
2f330caff57762 Markus Mayer 2017-08-24  511  	unsigned int dmem_size, imem_size, total_size;
2f330caff57762 Markus Mayer 2017-08-24  512  	bool is_big_endian = false;
2f330caff57762 Markus Mayer 2017-08-24  513  	const u32 *chksum_ptr;
2f330caff57762 Markus Mayer 2017-08-24  514  
2f330caff57762 Markus Mayer 2017-08-24  515  	if (header->magic == DPFE_BE_MAGIC)
2f330caff57762 Markus Mayer 2017-08-24  516  		is_big_endian = true;
2f330caff57762 Markus Mayer 2017-08-24  517  	else if (header->magic != DPFE_LE_MAGIC)
2f330caff57762 Markus Mayer 2017-08-24  518  		return ERR_INVALID_MAGIC;
2f330caff57762 Markus Mayer 2017-08-24  519  
2f330caff57762 Markus Mayer 2017-08-24  520  	if (is_big_endian) {
2f330caff57762 Markus Mayer 2017-08-24 @521  		dmem_size = be32_to_cpu(header->dmem_size);
2f330caff57762 Markus Mayer 2017-08-24  522  		imem_size = be32_to_cpu(header->imem_size);
2f330caff57762 Markus Mayer 2017-08-24  523  	} else {
2f330caff57762 Markus Mayer 2017-08-24 @524  		dmem_size = le32_to_cpu(header->dmem_size);
2f330caff57762 Markus Mayer 2017-08-24  525  		imem_size = le32_to_cpu(header->imem_size);
2f330caff57762 Markus Mayer 2017-08-24  526  	}
2f330caff57762 Markus Mayer 2017-08-24  527  
2f330caff57762 Markus Mayer 2017-08-24  528  	/* Data and instruction sections are 32 bit words. */
2f330caff57762 Markus Mayer 2017-08-24  529  	if ((dmem_size % sizeof(u32)) != 0 || (imem_size % sizeof(u32)) != 0)
2f330caff57762 Markus Mayer 2017-08-24  530  		return ERR_INVALID_SIZE;
2f330caff57762 Markus Mayer 2017-08-24  531  
2f330caff57762 Markus Mayer 2017-08-24  532  	/*
2f330caff57762 Markus Mayer 2017-08-24  533  	 * The header + the data section + the instruction section + the
2f330caff57762 Markus Mayer 2017-08-24  534  	 * checksum must be equal to the total firmware size.
2f330caff57762 Markus Mayer 2017-08-24  535  	 */
2f330caff57762 Markus Mayer 2017-08-24  536  	total_size = dmem_size + imem_size + sizeof(*header) +
2f330caff57762 Markus Mayer 2017-08-24  537  		sizeof(*chksum_ptr);
2f330caff57762 Markus Mayer 2017-08-24  538  	if (total_size != fw->size)
2f330caff57762 Markus Mayer 2017-08-24  539  		return ERR_INVALID_SIZE;
2f330caff57762 Markus Mayer 2017-08-24  540  
2f330caff57762 Markus Mayer 2017-08-24  541  	/* The checksum comes at the very end. */
2f330caff57762 Markus Mayer 2017-08-24  542  	chksum_ptr = (void *)fw->data + sizeof(*header) + dmem_size + imem_size;
2f330caff57762 Markus Mayer 2017-08-24  543  
2f330caff57762 Markus Mayer 2017-08-24  544  	init->is_big_endian = is_big_endian;
2f330caff57762 Markus Mayer 2017-08-24  545  	init->dmem_len = dmem_size;
2f330caff57762 Markus Mayer 2017-08-24  546  	init->imem_len = imem_size;
2f330caff57762 Markus Mayer 2017-08-24  547  	init->chksum = (is_big_endian)
2f330caff57762 Markus Mayer 2017-08-24  548  		? be32_to_cpu(*chksum_ptr) : le32_to_cpu(*chksum_ptr);
2f330caff57762 Markus Mayer 2017-08-24  549  
2f330caff57762 Markus Mayer 2017-08-24  550  	return 0;
2f330caff57762 Markus Mayer 2017-08-24  551  }
2f330caff57762 Markus Mayer 2017-08-24  552  

:::::: The code at line 521 was first introduced by commit
:::::: 2f330caff5776239abb3e0337533886dbb21f6df memory: brcmstb: Add driver for DPFE

:::::: TO: Markus Mayer <mmayer@...adcom.com>
:::::: CC: Florian Fainelli <f.fainelli@...il.com>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ