[tip:locking/core 19/44] kernel/futex/syscalls.c:82:16: sparse: sparse: cast removes address space '__user' of expression

From: kernel test robot
Date: Thu Oct 28 2021 - 16:14:20 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
head: 5197fcd09ab6dcc4df79edec7e8e27575276374c
commit: af8cc9600bbf2251b04c56139f7c83f87c3f878a [19/44] futex: Split out syscalls
config: riscv-randconfig-s031-20211028 (attached as .config)
compiler: riscv32-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/tip/tip.git/commit/?id=af8cc9600bbf2251b04c56139f7c83f87c3f878a
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip locking/core
git checkout af8cc9600bbf2251b04c56139f7c83f87c3f878a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash kernel/futex/

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


sparse warnings: (new ones prefixed by >>)
>> kernel/futex/syscalls.c:82:16: sparse: sparse: cast removes address space '__user' of expression

vim +/__user +82 kernel/futex/syscalls.c

44
45 /**
46 * sys_get_robust_list() - Get the robust-futex list head of a task
47 * @pid: pid of the process [zero for current task]
48 * @head_ptr: pointer to a list-head pointer, the kernel fills it in
49 * @len_ptr: pointer to a length field, the kernel fills in the header size
50 */
51 SYSCALL_DEFINE3(get_robust_list, int, pid,
52 struct robust_list_head __user * __user *, head_ptr,
53 size_t __user *, len_ptr)
54 {
55 struct robust_list_head __user *head;
56 unsigned long ret;
57 struct task_struct *p;
58
59 if (!futex_cmpxchg_enabled)
60 return -ENOSYS;
61
62 rcu_read_lock();
63
64 ret = -ESRCH;
65 if (!pid)
66 p = current;
67 else {
68 p = find_task_by_vpid(pid);
69 if (!p)
70 goto err_unlock;
71 }
72
73 ret = -EPERM;
74 if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS))
75 goto err_unlock;
76
77 head = p->robust_list;
78 rcu_read_unlock();
79
80 if (put_user(sizeof(*head), len_ptr))
81 return -EFAULT;
> 82 return put_user(head, head_ptr);
83
84 err_unlock:
85 rcu_read_unlock();
86
87 return ret;
88 }
89

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

Attachment: .config.gz
Description: application/gzip