Skip to content

Commit 986b9ea

Browse files
Villemoestorvalds
authored andcommitted
kernel/sys.c: fix prototype of prctl_get_tid_address()
tid_addr is not a "pointer to (pointer to int in userspace)"; it is in fact a "pointer to (pointer to int in userspace) in userspace". So sparse rightfully complains about passing a kernel pointer to put_user(). Reported-by: kernel test robot <[email protected]> Signed-off-by: Rasmus Villemoes <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 23224e4 commit 986b9ea

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/sys.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,12 +2238,12 @@ static int prctl_set_mm(int opt, unsigned long addr,
22382238
}
22392239

22402240
#ifdef CONFIG_CHECKPOINT_RESTORE
2241-
static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr)
2241+
static int prctl_get_tid_address(struct task_struct *me, int __user * __user *tid_addr)
22422242
{
22432243
return put_user(me->clear_child_tid, tid_addr);
22442244
}
22452245
#else
2246-
static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr)
2246+
static int prctl_get_tid_address(struct task_struct *me, int __user * __user *tid_addr)
22472247
{
22482248
return -EINVAL;
22492249
}
@@ -2427,7 +2427,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
24272427
error = prctl_set_mm(arg2, arg3, arg4, arg5);
24282428
break;
24292429
case PR_GET_TID_ADDRESS:
2430-
error = prctl_get_tid_address(me, (int __user **)arg2);
2430+
error = prctl_get_tid_address(me, (int __user * __user *)arg2);
24312431
break;
24322432
case PR_SET_CHILD_SUBREAPER:
24332433
me->signal->is_child_subreaper = !!arg2;

0 commit comments

Comments
 (0)