drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Fri Feb 12 2021 - 06:50:07 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dcc0b49040c70ad827a7f3d58a21b01fdb14e749
commit: 4184da4f316a549ae732d91088571fef46a2f58d staging: vchiq: fix __user annotations
date: 5 months ago
config: sh-randconfig-s032-20210212 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.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.3-215-g0fb77bb6-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4184da4f316a549ae732d91088571fef46a2f58d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4184da4f316a549ae732d91088571fef46a2f58d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh

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/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1000:56: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *offset @@ got void [noderef] __user *data @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1000:56: sparse: expected void *offset
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1000:56: sparse: got void [noderef] __user *data
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1214:47: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user *[addressable] [assigned] bulk_userdata @@ got void *bulk_userdata @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1214:47: sparse: expected void [noderef] __user *[addressable] [assigned] bulk_userdata
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1214:47: sparse: got void *bulk_userdata
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user * @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: expected unsigned int const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: got unsigned int [noderef] [usertype] __user *
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: expected void const volatile [noderef] __user *ptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1051:23: sparse: got unsigned int const *__gu_addr
>> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned long const *__gu_addr @@ got unsigned long [noderef] [usertype] __user * @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: expected unsigned long const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: got unsigned long [noderef] [usertype] __user *
>> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned long const *__gu_addr @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: expected void const volatile [noderef] __user *ptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1055:23: sparse: got unsigned long const *__gu_addr

vim +1055 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

1042
1043 /* read a user pointer value from an array pointers in user space */
1044 static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int index)
1045 {
1046 int ret;
1047
1048 if (in_compat_syscall()) {
1049 compat_uptr_t ptr32;
1050 compat_uptr_t __user *uptr = ubuf;
1051 ret = get_user(ptr32, uptr + index);
1052 *buf = compat_ptr(ptr32);
1053 } else {
1054 uintptr_t ptr, __user *uptr = ubuf;
> 1055 ret = get_user(ptr, uptr + index);
1056 *buf = (void __user *)ptr;
1057 }
1058
1059 return ret;
1060 }
1061

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

Attachment: .config.gz
Description: application/gzip