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: <202006120039.WXViFDE4%lkp@intel.com>
Date:   Fri, 12 Jun 2020 00:57:43 +0800
From:   kernel test robot <lkp@...el.com>
To:     Carlo Caione <ccaione@...libre.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Kevin Hilman <khilman@...libre.com>,
        Jerome Brunet <jbrunet@...libre.com>
Subject: drivers/firmware/meson/meson_sm.c:168:34: sparse: sparse: incorrect
 type in argument 2 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b29482fde649c72441d5478a4ea2c52c56d97a5e
commit: 8cde3c2153e8f57be884c0e73f18bc4de150e870 firmware: meson_sm: Rework driver as a proper platform driver
date:   8 months ago
config: arm64-randconfig-s031-20200611 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-250-g42323db3-dirty
        git checkout 8cde3c2153e8f57be884c0e73f18bc4de150e870
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=arm64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

   drivers/firmware/meson/meson_sm.c:83:24: sparse: sparse: Using plain integer as NULL pointer
>> drivers/firmware/meson/meson_sm.c:168:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const *q @@     got void [noderef] <asn:2> *sm_shmem_out_base @@
   drivers/firmware/meson/meson_sm.c:168:34: sparse:     expected void const *q
>> drivers/firmware/meson/meson_sm.c:168:34: sparse:     got void [noderef] <asn:2> *sm_shmem_out_base
>> drivers/firmware/meson/meson_sm.c:204:18: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *p @@     got void [noderef] <asn:2> *sm_shmem_in_base @@
   drivers/firmware/meson/meson_sm.c:204:18: sparse:     expected void *p
>> drivers/firmware/meson/meson_sm.c:204:18: sparse:     got void [noderef] <asn:2> *sm_shmem_in_base

vim +168 drivers/firmware/meson/meson_sm.c

    76	
    77	static void __iomem *meson_sm_map_shmem(u32 cmd_shmem, unsigned int size)
    78	{
    79		u32 sm_phy_base;
    80	
    81		sm_phy_base = __meson_sm_call(cmd_shmem, 0, 0, 0, 0, 0);
    82		if (!sm_phy_base)
  > 83			return 0;
    84	
    85		return ioremap_cache(sm_phy_base, size);
    86	}
    87	
    88	/**
    89	 * meson_sm_call - generic SMC32 call to the secure-monitor
    90	 *
    91	 * @fw:		Pointer to secure-monitor firmware
    92	 * @cmd_index:	Index of the SMC32 function ID
    93	 * @ret:	Returned value
    94	 * @arg0:	SMC32 Argument 0
    95	 * @arg1:	SMC32 Argument 1
    96	 * @arg2:	SMC32 Argument 2
    97	 * @arg3:	SMC32 Argument 3
    98	 * @arg4:	SMC32 Argument 4
    99	 *
   100	 * Return:	0 on success, a negative value on error
   101	 */
   102	int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index,
   103			  u32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
   104	{
   105		u32 cmd, lret;
   106	
   107		if (!fw->chip)
   108			return -ENOENT;
   109	
   110		cmd = meson_sm_get_cmd(fw->chip, cmd_index);
   111		if (!cmd)
   112			return -EINVAL;
   113	
   114		lret = __meson_sm_call(cmd, arg0, arg1, arg2, arg3, arg4);
   115	
   116		if (ret)
   117			*ret = lret;
   118	
   119		return 0;
   120	}
   121	EXPORT_SYMBOL(meson_sm_call);
   122	
   123	/**
   124	 * meson_sm_call_read - retrieve data from secure-monitor
   125	 *
   126	 * @fw:		Pointer to secure-monitor firmware
   127	 * @buffer:	Buffer to store the retrieved data
   128	 * @bsize:	Size of the buffer
   129	 * @cmd_index:	Index of the SMC32 function ID
   130	 * @arg0:	SMC32 Argument 0
   131	 * @arg1:	SMC32 Argument 1
   132	 * @arg2:	SMC32 Argument 2
   133	 * @arg3:	SMC32 Argument 3
   134	 * @arg4:	SMC32 Argument 4
   135	 *
   136	 * Return:	size of read data on success, a negative value on error
   137	 *		When 0 is returned there is no guarantee about the amount of
   138	 *		data read and bsize bytes are copied in buffer.
   139	 */
   140	int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer,
   141			       unsigned int bsize, unsigned int cmd_index, u32 arg0,
   142			       u32 arg1, u32 arg2, u32 arg3, u32 arg4)
   143	{
   144		u32 size;
   145		int ret;
   146	
   147		if (!fw->chip)
   148			return -ENOENT;
   149	
   150		if (!fw->chip->cmd_shmem_out_base)
   151			return -EINVAL;
   152	
   153		if (bsize > fw->chip->shmem_size)
   154			return -EINVAL;
   155	
   156		if (meson_sm_call(fw, cmd_index, &size, arg0, arg1, arg2, arg3, arg4) < 0)
   157			return -EINVAL;
   158	
   159		if (size > bsize)
   160			return -EINVAL;
   161	
   162		ret = size;
   163	
   164		if (!size)
   165			size = bsize;
   166	
   167		if (buffer)
 > 168			memcpy(buffer, fw->sm_shmem_out_base, size);
   169	
   170		return ret;
   171	}
   172	EXPORT_SYMBOL(meson_sm_call_read);
   173	
   174	/**
   175	 * meson_sm_call_write - send data to secure-monitor
   176	 *
   177	 * @fw:		Pointer to secure-monitor firmware
   178	 * @buffer:	Buffer containing data to send
   179	 * @size:	Size of the data to send
   180	 * @cmd_index:	Index of the SMC32 function ID
   181	 * @arg0:	SMC32 Argument 0
   182	 * @arg1:	SMC32 Argument 1
   183	 * @arg2:	SMC32 Argument 2
   184	 * @arg3:	SMC32 Argument 3
   185	 * @arg4:	SMC32 Argument 4
   186	 *
   187	 * Return:	size of sent data on success, a negative value on error
   188	 */
   189	int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
   190				unsigned int size, unsigned int cmd_index, u32 arg0,
   191				u32 arg1, u32 arg2, u32 arg3, u32 arg4)
   192	{
   193		u32 written;
   194	
   195		if (!fw->chip)
   196			return -ENOENT;
   197	
   198		if (size > fw->chip->shmem_size)
   199			return -EINVAL;
   200	
   201		if (!fw->chip->cmd_shmem_in_base)
   202			return -EINVAL;
   203	
 > 204		memcpy(fw->sm_shmem_in_base, buffer, size);
   205	
   206		if (meson_sm_call(fw, cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0)
   207			return -EINVAL;
   208	
   209		if (!written)
   210			return -EINVAL;
   211	
   212		return written;
   213	}
   214	EXPORT_SYMBOL(meson_sm_call_write);
   215	

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

Download attachment ".config.gz" of type "application/gzip" (32475 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ