[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202207312255.bPrNIfCh-lkp@intel.com>
Date: Sun, 31 Jul 2022 22:50:16 +0800
From: kernel test robot <lkp@...el.com>
To: Kees Cook <keescook@...omium.org>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/firmware/meson/meson_sm.c:206:9: sparse: sparse: incorrect
type in argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6a010258447d386186ca10cd374d888ac66ffe1a
commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
date: 6 months ago
config: arm64-randconfig-s031-20220731 (https://download.01.org/0day-ci/archive/20220731/202207312255.bPrNIfCh-lkp@intel.com/config)
compiler: aarch64-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://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f68f2ff91512c199ec24883001245912afc17873
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f68f2ff91512c199ec24883001245912afc17873
# 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=arm64 SHELL=/bin/bash arch/arm64/kernel/ drivers/firmware/meson/
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/firmware/meson/meson_sm.c:85:24: sparse: sparse: Using plain integer as NULL pointer
drivers/firmware/meson/meson_sm.c:170:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *sm_shmem_out_base @@
drivers/firmware/meson/meson_sm.c:170:17: sparse: expected void const *
drivers/firmware/meson/meson_sm.c:170:17: sparse: got void [noderef] __iomem *sm_shmem_out_base
drivers/firmware/meson/meson_sm.c:170:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *sm_shmem_out_base @@
drivers/firmware/meson/meson_sm.c:170:17: sparse: expected void const *
drivers/firmware/meson/meson_sm.c:170:17: sparse: got void [noderef] __iomem *sm_shmem_out_base
drivers/firmware/meson/meson_sm.c:170:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *sm_shmem_out_base @@
drivers/firmware/meson/meson_sm.c:170:17: sparse: expected void const *
drivers/firmware/meson/meson_sm.c:170:17: sparse: got void [noderef] __iomem *sm_shmem_out_base
>> drivers/firmware/meson/meson_sm.c:206:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *sm_shmem_in_base @@
drivers/firmware/meson/meson_sm.c:206:9: sparse: expected void const *
drivers/firmware/meson/meson_sm.c:206:9: sparse: got void [noderef] __iomem *sm_shmem_in_base
>> drivers/firmware/meson/meson_sm.c:206:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *sm_shmem_in_base @@
drivers/firmware/meson/meson_sm.c:206:9: sparse: expected void const *
drivers/firmware/meson/meson_sm.c:206:9: sparse: got void [noderef] __iomem *sm_shmem_in_base
drivers/firmware/meson/meson_sm.c:206:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *sm_shmem_in_base @@
drivers/firmware/meson/meson_sm.c:206:9: sparse: expected void *
drivers/firmware/meson/meson_sm.c:206:9: sparse: got void [noderef] __iomem *sm_shmem_in_base
vim +206 drivers/firmware/meson/meson_sm.c
2c4ddb215521d5 Carlo Caione 2016-08-27 175
2c4ddb215521d5 Carlo Caione 2016-08-27 176 /**
2c4ddb215521d5 Carlo Caione 2016-08-27 177 * meson_sm_call_write - send data to secure-monitor
2c4ddb215521d5 Carlo Caione 2016-08-27 178 *
8cde3c2153e8f5 Carlo Caione 2019-07-31 179 * @fw: Pointer to secure-monitor firmware
2c4ddb215521d5 Carlo Caione 2016-08-27 180 * @buffer: Buffer containing data to send
2c4ddb215521d5 Carlo Caione 2016-08-27 181 * @size: Size of the data to send
2c4ddb215521d5 Carlo Caione 2016-08-27 182 * @cmd_index: Index of the SMC32 function ID
2c4ddb215521d5 Carlo Caione 2016-08-27 183 * @arg0: SMC32 Argument 0
2c4ddb215521d5 Carlo Caione 2016-08-27 184 * @arg1: SMC32 Argument 1
2c4ddb215521d5 Carlo Caione 2016-08-27 185 * @arg2: SMC32 Argument 2
2c4ddb215521d5 Carlo Caione 2016-08-27 186 * @arg3: SMC32 Argument 3
2c4ddb215521d5 Carlo Caione 2016-08-27 187 * @arg4: SMC32 Argument 4
2c4ddb215521d5 Carlo Caione 2016-08-27 188 *
2c4ddb215521d5 Carlo Caione 2016-08-27 189 * Return: size of sent data on success, a negative value on error
2c4ddb215521d5 Carlo Caione 2016-08-27 190 */
8cde3c2153e8f5 Carlo Caione 2019-07-31 191 int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
8cde3c2153e8f5 Carlo Caione 2019-07-31 192 unsigned int size, unsigned int cmd_index, u32 arg0,
8cde3c2153e8f5 Carlo Caione 2019-07-31 193 u32 arg1, u32 arg2, u32 arg3, u32 arg4)
2c4ddb215521d5 Carlo Caione 2016-08-27 194 {
2c4ddb215521d5 Carlo Caione 2016-08-27 195 u32 written;
2c4ddb215521d5 Carlo Caione 2016-08-27 196
8cde3c2153e8f5 Carlo Caione 2019-07-31 197 if (!fw->chip)
2c4ddb215521d5 Carlo Caione 2016-08-27 198 return -ENOENT;
2c4ddb215521d5 Carlo Caione 2016-08-27 199
8cde3c2153e8f5 Carlo Caione 2019-07-31 200 if (size > fw->chip->shmem_size)
2c4ddb215521d5 Carlo Caione 2016-08-27 201 return -EINVAL;
2c4ddb215521d5 Carlo Caione 2016-08-27 202
8cde3c2153e8f5 Carlo Caione 2019-07-31 203 if (!fw->chip->cmd_shmem_in_base)
2c4ddb215521d5 Carlo Caione 2016-08-27 204 return -EINVAL;
2c4ddb215521d5 Carlo Caione 2016-08-27 205
8cde3c2153e8f5 Carlo Caione 2019-07-31 @206 memcpy(fw->sm_shmem_in_base, buffer, size);
2c4ddb215521d5 Carlo Caione 2016-08-27 207
8cde3c2153e8f5 Carlo Caione 2019-07-31 208 if (meson_sm_call(fw, cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0)
2c4ddb215521d5 Carlo Caione 2016-08-27 209 return -EINVAL;
2c4ddb215521d5 Carlo Caione 2016-08-27 210
2c4ddb215521d5 Carlo Caione 2016-08-27 211 if (!written)
2c4ddb215521d5 Carlo Caione 2016-08-27 212 return -EINVAL;
2c4ddb215521d5 Carlo Caione 2016-08-27 213
2c4ddb215521d5 Carlo Caione 2016-08-27 214 return written;
2c4ddb215521d5 Carlo Caione 2016-08-27 215 }
2c4ddb215521d5 Carlo Caione 2016-08-27 216 EXPORT_SYMBOL(meson_sm_call_write);
2c4ddb215521d5 Carlo Caione 2016-08-27 217
:::::: The code at line 206 was first introduced by commit
:::::: 8cde3c2153e8f57be884c0e73f18bc4de150e870 firmware: meson_sm: Rework driver as a proper platform driver
:::::: TO: Carlo Caione <ccaione@...libre.com>
:::::: CC: Kevin Hilman <khilman@...libre.com>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists