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

From: kernel test robot
Date: Fri Feb 12 2021 - 06:24:23 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dcc0b49040c70ad827a7f3d58a21b01fdb14e749
commit: 5d240a54be7e5921856ce1baa3642351aa118dbc staging: vchiq: convert compat await_completion
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=5d240a54be7e5921856ce1baa3642351aa118dbc
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5d240a54be7e5921856ce1baa3642351aa118dbc
# 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:1062:62: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *uptr @@ got struct vchiq_header *[noderef] __user header @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1062:62: sparse: expected void [noderef] __user *uptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1062:62: sparse: got struct vchiq_header *[noderef] __user header
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1063:62: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *uptr @@ got void *[noderef] __user service_userdata @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1063:62: sparse: expected void [noderef] __user *uptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1063:62: sparse: got void *[noderef] __user service_userdata
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1064:62: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *uptr @@ got void *[noderef] __user bulk_userdata @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1064:62: sparse: expected void [noderef] __user *uptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1064:62: sparse: got void *[noderef] __user bulk_userdata
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1161:58: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] __user *ubuf @@ got void *** @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1161:58: sparse: expected void [noderef] __user *ubuf
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1161:58: sparse: got void ***
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1189:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct vchiq_completion_data [noderef] __user *buf @@ got struct vchiq_completion_data *buf @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1189:46: sparse: expected struct vchiq_completion_data [noderef] __user *buf
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1189:46: sparse: got struct vchiq_completion_data *buf
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1061:45: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1062:59: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1062:59: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1063:59: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1063:59: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1064:59: sparse: sparse: dereference of noderef expression
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1064:59: sparse: sparse: dereference of noderef expression
>> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1037: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:1037:23: sparse: expected unsigned int const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1037:23: sparse: got unsigned int [noderef] [usertype] __user *
>> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1037: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:1037:23: sparse: expected void const volatile [noderef] __user *ptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1037:23: sparse: got unsigned int const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __user *const *__gu_addr @@ got void [noderef] __user *[noderef] __user * @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: expected void [noderef] __user *const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: got void [noderef] __user *[noderef] __user *
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got void [noderef] __user *const *__gu_addr @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: expected void const volatile [noderef] __user *ptr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: got void [noderef] __user *const *__gu_addr
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __user **buf @@ got void [noderef] __user * @@
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: expected void [noderef] __user **buf
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1041:23: sparse: got void [noderef] __user *

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

1029
1030 static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int index)
1031 {
1032 compat_uptr_t ptr32;
1033 int ret;
1034
1035 if (in_compat_syscall()) {
1036 compat_uptr_t __user *uptr = ubuf;
> 1037 ret = get_user(ptr32, &uptr[index]);
1038 *buf = compat_ptr(ptr32);
1039 } else {
1040 void __user *__user *uptr = ubuf;
1041 ret = get_user(buf, &uptr[index]);
1042 }
1043 return ret;
1044 }
1045

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

Attachment: .config.gz
Description: application/gzip