[linux-next:master 3546/4328] drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32

[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:   40354149f4d738dc3492d9998e45b3f02950369a
commit: f1383348ad0fe0d568dfd37f2552b0b4f044dbe5 [3546/4328] soc: qcom: smem: validate fields of shared structures
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220415/202204152011.PHS6Q52v-lkp@xxxxxxxxx/config)
compiler: m68k-linux-gcc (GCC) 11.2.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-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=f1383348ad0fe0d568dfd37f2552b0b4f044dbe5
        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 f1383348ad0fe0d568dfd37f2552b0b4f044dbe5
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash drivers/soc/qcom/ mm/

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


sparse warnings: (new ones prefixed by >>)
   drivers/soc/qcom/smem.c:430:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_header *header @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:430:16: sparse:     expected struct smem_header *header
   drivers/soc/qcom/smem.c:430:16: sparse:     got void [noderef] __iomem *virt_base
   drivers/soc/qcom/smem.c:517:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_header *header @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:517:16: sparse:     expected struct smem_header *header
   drivers/soc/qcom/smem.c:517:16: sparse:     got void [noderef] __iomem *virt_base
   drivers/soc/qcom/smem.c:537:50: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void * @@     got void [noderef] __iomem * @@
   drivers/soc/qcom/smem.c:537:50: sparse:     expected void *
   drivers/soc/qcom/smem.c:537:50: sparse:     got void [noderef] __iomem *
   drivers/soc/qcom/smem.c:698:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_partition_header *phdr @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:698:22: sparse:     expected struct smem_partition_header *phdr
   drivers/soc/qcom/smem.c:698:22: sparse:     got void [noderef] __iomem *virt_base
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
>> drivers/soc/qcom/smem.c:702:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:706:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_partition_header *phdr @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:706:22: sparse:     expected struct smem_partition_header *phdr
   drivers/soc/qcom/smem.c:706:22: sparse:     got void [noderef] __iomem *virt_base
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:710:27: sparse: sparse: cast to restricted __le32
   drivers/soc/qcom/smem.c:713:24: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_header *header @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:713:24: sparse:     expected struct smem_header *header
   drivers/soc/qcom/smem.c:713:24: sparse:     got void [noderef] __iomem *virt_base
   drivers/soc/qcom/smem.c:726:30: sparse: sparse: incompatible types in comparison expression (different address spaces):
   drivers/soc/qcom/smem.c:726:30: sparse:    void *
   drivers/soc/qcom/smem.c:726:30: sparse:    void [noderef] __iomem *
   drivers/soc/qcom/smem.c:747:36: sparse: sparse: subtraction of different types can't work (different address spaces)
   drivers/soc/qcom/smem.c:756:28: sparse: sparse: subtraction of different types can't work (different address spaces)
   drivers/soc/qcom/smem.c:765:36: sparse: sparse: subtraction of different types can't work (different address spaces)
   drivers/soc/qcom/smem.c:780:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_header *header @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:780:16: sparse:     expected struct smem_header *header
   drivers/soc/qcom/smem.c:780:16: sparse:     got void [noderef] __iomem *virt_base
   drivers/soc/qcom/smem.c:813:57: sparse: sparse: restricted __le32 degrades to integer
   drivers/soc/qcom/smem.c:834:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_partition_header *header @@     got void [noderef] __iomem * @@
   drivers/soc/qcom/smem.c:834:16: sparse:     expected struct smem_partition_header *header
   drivers/soc/qcom/smem.c:834:16: sparse:     got void [noderef] __iomem *
   drivers/soc/qcom/smem.c:985:22: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_ptable *ptable @@     got void [noderef] __iomem * @@
   drivers/soc/qcom/smem.c:985:22: sparse:     expected struct smem_ptable *ptable
   drivers/soc/qcom/smem.c:985:22: sparse:     got void [noderef] __iomem *
   drivers/soc/qcom/smem.c:1094:16: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct smem_header *header @@     got void [noderef] __iomem *virt_base @@
   drivers/soc/qcom/smem.c:1094:16: sparse:     expected struct smem_header *header
   drivers/soc/qcom/smem.c:1094:16: sparse:     got void [noderef] __iomem *virt_base

vim +702 drivers/soc/qcom/smem.c

   678	
   679	/**
   680	 * qcom_smem_get_free_space() - retrieve amount of free space in a partition
   681	 * @host:	the remote processor identifying a partition, or -1
   682	 *
   683	 * To be used by smem clients as a quick way to determine if any new
   684	 * allocations has been made.
   685	 */
   686	int qcom_smem_get_free_space(unsigned host)
   687	{
   688		struct smem_partition *part;
   689		struct smem_partition_header *phdr;
   690		struct smem_header *header;
   691		unsigned ret;
   692	
   693		if (!__smem)
   694			return -EPROBE_DEFER;
   695	
   696		if (host < SMEM_HOST_COUNT && __smem->partitions[host].virt_base) {
   697			part = &__smem->partitions[host];
   698			phdr = part->virt_base;
   699			ret = le32_to_cpu(phdr->offset_free_cached) -
   700			      le32_to_cpu(phdr->offset_free_uncached);
   701	
 > 702			if (ret > le32_to_cpu(part->size))
   703				return -EINVAL;
   704		} else if (__smem->global_partition.virt_base) {
   705			part = &__smem->global_partition;
   706			phdr = part->virt_base;
   707			ret = le32_to_cpu(phdr->offset_free_cached) -
   708			      le32_to_cpu(phdr->offset_free_uncached);
   709	
   710			if (ret > le32_to_cpu(part->size))
   711				return -EINVAL;
   712		} else {
   713			header = __smem->regions[0].virt_base;
   714			ret = le32_to_cpu(header->available);
   715	
   716			if (ret > __smem->regions[0].size)
   717				return -EINVAL;
   718		}
   719	
   720		return ret;
   721	}
   722	EXPORT_SYMBOL(qcom_smem_get_free_space);
   723	

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




[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