[PATCH] uml: more __user annotations

From: Al Viro <viro@zeniv.linux.org.uk>

uml __user annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Al Viro and committed by Linus Torvalds b8719c31 ca34fb1a

+22 -17
+5 -4
arch/um/sys-i386/syscalls.c
··· 99 100 switch (call) { 101 case SEMOP: 102 - return sys_semtimedop(first, (struct sembuf *) ptr, second, 103 - NULL); 104 case SEMTIMEDOP: 105 - return sys_semtimedop(first, (struct sembuf *) ptr, second, 106 - (const struct timespec *) fifth); 107 case SEMGET: 108 return sys_semget (first, second, third); 109 case SEMCTL: {
··· 99 100 switch (call) { 101 case SEMOP: 102 + return sys_semtimedop(first, (struct sembuf __user *) ptr, 103 + second, NULL); 104 case SEMTIMEDOP: 105 + return sys_semtimedop(first, (struct sembuf __user *) ptr, 106 + second, 107 + (const struct timespec __user *) fifth); 108 case SEMGET: 109 return sys_semget (first, second, third); 110 case SEMCTL: {
+14 -10
arch/um/sys-x86_64/signal.c
··· 21 #include "skas.h" 22 23 static int copy_sc_from_user_skas(struct pt_regs *regs, 24 - struct sigcontext *from) 25 { 26 int err = 0; 27 ··· 54 return(err); 55 } 56 57 - int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 58 struct pt_regs *regs, unsigned long mask, 59 unsigned long sp) 60 { ··· 107 #endif 108 109 #ifdef CONFIG_MODE_TT 110 - int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, 111 int fpsize) 112 { 113 - struct _fpstate *to_fp, *from_fp; 114 unsigned long sigs; 115 int err; 116 ··· 126 return(err); 127 } 128 129 - int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 130 struct sigcontext *from, int fpsize, unsigned long sp) 131 { 132 - struct _fpstate *to_fp, *from_fp; 133 int err; 134 135 - to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 136 from_fp = from->fpstate; 137 err = copy_to_user(to, from, sizeof(*to)); 138 /* The SP in the sigcontext is the updated one for the signal ··· 161 return(ret); 162 } 163 164 - static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 165 struct pt_regs *from, unsigned long mask, 166 unsigned long sp) 167 { ··· 173 174 struct rt_sigframe 175 { 176 - char *pretcode; 177 struct ucontext uc; 178 struct siginfo info; 179 }; ··· 192 193 frame = (struct rt_sigframe __user *) 194 round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; 195 - frame = (struct rt_sigframe *) ((unsigned long) frame - 128); 196 197 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) 198 goto out;
··· 21 #include "skas.h" 22 23 static int copy_sc_from_user_skas(struct pt_regs *regs, 24 + struct sigcontext __user *from) 25 { 26 int err = 0; 27 ··· 54 return(err); 55 } 56 57 + int copy_sc_to_user_skas(struct sigcontext __user *to, 58 + struct _fpstate __user *to_fp, 59 struct pt_regs *regs, unsigned long mask, 60 unsigned long sp) 61 { ··· 106 #endif 107 108 #ifdef CONFIG_MODE_TT 109 + int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from, 110 int fpsize) 111 { 112 + struct _fpstate *to_fp; 113 + struct _fpstate __user *from_fp; 114 unsigned long sigs; 115 int err; 116 ··· 124 return(err); 125 } 126 127 + int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp, 128 struct sigcontext *from, int fpsize, unsigned long sp) 129 { 130 + struct _fpstate __user *to_fp; 131 + struct _fpstate *from_fp; 132 int err; 133 134 + to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1)); 135 from_fp = from->fpstate; 136 err = copy_to_user(to, from, sizeof(*to)); 137 /* The SP in the sigcontext is the updated one for the signal ··· 158 return(ret); 159 } 160 161 + static int copy_sc_to_user(struct sigcontext __user *to, 162 + struct _fpstate __user *fp, 163 struct pt_regs *from, unsigned long mask, 164 unsigned long sp) 165 { ··· 169 170 struct rt_sigframe 171 { 172 + char __user *pretcode; 173 struct ucontext uc; 174 struct siginfo info; 175 }; ··· 188 189 frame = (struct rt_sigframe __user *) 190 round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8; 191 + frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128); 192 193 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) 194 goto out;
+3 -3
include/asm-um/uaccess.h
··· 41 42 #define __get_user(x, ptr) \ 43 ({ \ 44 - const __typeof__(ptr) __private_ptr = ptr; \ 45 __typeof__(x) __private_val; \ 46 int __private_ret = -EFAULT; \ 47 (x) = (__typeof__(*(__private_ptr)))0; \ 48 - if (__copy_from_user((void *) &__private_val, (__private_ptr), \ 49 sizeof(*(__private_ptr))) == 0) { \ 50 (x) = (__typeof__(*(__private_ptr))) __private_val; \ 51 __private_ret = 0; \ ··· 62 63 #define __put_user(x, ptr) \ 64 ({ \ 65 - __typeof__(ptr) __private_ptr = ptr; \ 66 __typeof__(*(__private_ptr)) __private_val; \ 67 int __private_ret = -EFAULT; \ 68 __private_val = (__typeof__(*(__private_ptr))) (x); \
··· 41 42 #define __get_user(x, ptr) \ 43 ({ \ 44 + const __typeof__(*(ptr)) __user *__private_ptr = (ptr); \ 45 __typeof__(x) __private_val; \ 46 int __private_ret = -EFAULT; \ 47 (x) = (__typeof__(*(__private_ptr)))0; \ 48 + if (__copy_from_user((__force void *)&__private_val, (__private_ptr),\ 49 sizeof(*(__private_ptr))) == 0) { \ 50 (x) = (__typeof__(*(__private_ptr))) __private_val; \ 51 __private_ret = 0; \ ··· 62 63 #define __put_user(x, ptr) \ 64 ({ \ 65 + __typeof__(*(ptr)) __user *__private_ptr = ptr; \ 66 __typeof__(*(__private_ptr)) __private_val; \ 67 int __private_ret = -EFAULT; \ 68 __private_val = (__typeof__(*(__private_ptr))) (x); \