aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-31 05:30:15 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:51 -0500
commit4d338e1accfc3473f7e453427dfd4f1ebf4dbbe6 (patch)
treeac6559e533cd4720b5c5b13119b3d10f0ab8b51d /arch/um/sys-i386
parent694a464e19b9e3278dbaf6a09fa7c1efec3f8eb5 (diff)
[PATCH] uml: sparse cleanups
misc sparse 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>
Diffstat (limited to 'arch/um/sys-i386')
-rw-r--r--arch/um/sys-i386/ptrace.c28
-rw-r--r--arch/um/sys-i386/signal.c48
-rw-r--r--arch/um/sys-i386/syscalls.c2
3 files changed, 40 insertions, 38 deletions
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 8032a105949a..ff94eded93eb 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -124,22 +124,22 @@ unsigned long getreg(struct task_struct *child, int regno)
124int peek_user(struct task_struct *child, long addr, long data) 124int peek_user(struct task_struct *child, long addr, long data)
125{ 125{
126/* read the word at location addr in the USER area. */ 126/* read the word at location addr in the USER area. */
127 unsigned long tmp; 127 unsigned long tmp;
128 128
129 if ((addr & 3) || addr < 0) 129 if ((addr & 3) || addr < 0)
130 return -EIO; 130 return -EIO;
131 131
132 tmp = 0; /* Default return condition */ 132 tmp = 0; /* Default return condition */
133 if(addr < MAX_REG_OFFSET){ 133 if(addr < MAX_REG_OFFSET){
134 tmp = getreg(child, addr); 134 tmp = getreg(child, addr);
135 } 135 }
136 else if((addr >= offsetof(struct user, u_debugreg[0])) && 136 else if((addr >= offsetof(struct user, u_debugreg[0])) &&
137 (addr <= offsetof(struct user, u_debugreg[7]))){ 137 (addr <= offsetof(struct user, u_debugreg[7]))){
138 addr -= offsetof(struct user, u_debugreg[0]); 138 addr -= offsetof(struct user, u_debugreg[0]);
139 addr = addr >> 2; 139 addr = addr >> 2;
140 tmp = child->thread.arch.debugregs[addr]; 140 tmp = child->thread.arch.debugregs[addr];
141 } 141 }
142 return put_user(tmp, (unsigned long *) data); 142 return put_user(tmp, (unsigned long __user *) data);
143} 143}
144 144
145struct i387_fxsave_struct { 145struct i387_fxsave_struct {
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 33a40f5ef0d2..f5d0e1c37ea2 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -19,7 +19,7 @@
19#include "skas.h" 19#include "skas.h"
20 20
21static int copy_sc_from_user_skas(struct pt_regs *regs, 21static int copy_sc_from_user_skas(struct pt_regs *regs,
22 struct sigcontext *from) 22 struct sigcontext __user *from)
23{ 23{
24 struct sigcontext sc; 24 struct sigcontext sc;
25 unsigned long fpregs[HOST_FP_SIZE]; 25 unsigned long fpregs[HOST_FP_SIZE];
@@ -57,7 +57,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
57 return(0); 57 return(0);
58} 58}
59 59
60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate __user *to_fp,
61 struct pt_regs *regs, unsigned long sp) 61 struct pt_regs *regs, unsigned long sp)
62{ 62{
63 struct sigcontext sc; 63 struct sigcontext sc;
@@ -92,7 +92,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
92 "errno = %d\n", err); 92 "errno = %d\n", err);
93 return(1); 93 return(1);
94 } 94 }
95 to_fp = (to_fp ? to_fp : (struct _fpstate *) (to + 1)); 95 to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
96 sc.fpstate = to_fp; 96 sc.fpstate = to_fp;
97 97
98 if(err) 98 if(err)
@@ -113,10 +113,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
113 * saved pointer is in the kernel, but the sigcontext is in userspace, so we 113 * saved pointer is in the kernel, but the sigcontext is in userspace, so we
114 * copy_to_user it. 114 * copy_to_user it.
115 */ 115 */
116int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, 116int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
117 int fpsize) 117 int fpsize)
118{ 118{
119 struct _fpstate *to_fp, *from_fp; 119 struct _fpstate *to_fp;
120 struct _fpstate __user *from_fp;
120 unsigned long sigs; 121 unsigned long sigs;
121 int err; 122 int err;
122 123
@@ -131,13 +132,14 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
131 return(err); 132 return(err);
132} 133}
133 134
134int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 135int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate __user *fp,
135 struct sigcontext *from, int fpsize, unsigned long sp) 136 struct sigcontext *from, int fpsize, unsigned long sp)
136{ 137{
137 struct _fpstate *to_fp, *from_fp; 138 struct _fpstate __user *to_fp;
139 struct _fpstate *from_fp;
138 int err; 140 int err;
139 141
140 to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 142 to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
141 from_fp = from->fpstate; 143 from_fp = from->fpstate;
142 err = copy_to_user(to, from, sizeof(*to)); 144 err = copy_to_user(to, from, sizeof(*to));
143 145
@@ -165,7 +167,7 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
165 return(ret); 167 return(ret);
166} 168}
167 169
168static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 170static int copy_sc_to_user(struct sigcontext *to, struct _fpstate __user *fp,
169 struct pt_regs *from, unsigned long sp) 171 struct pt_regs *from, unsigned long sp)
170{ 172{
171 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 173 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
@@ -173,7 +175,7 @@ static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
173 copy_sc_to_user_skas(to, fp, from, sp))); 175 copy_sc_to_user_skas(to, fp, from, sp)));
174} 176}
175 177
176static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp, 178static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp,
177 sigset_t *set, unsigned long sp) 179 sigset_t *set, unsigned long sp)
178{ 180{
179 int err = 0; 181 int err = 0;
@@ -188,7 +190,7 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
188 190
189struct sigframe 191struct sigframe
190{ 192{
191 char *pretcode; 193 char __user *pretcode;
192 int sig; 194 int sig;
193 struct sigcontext sc; 195 struct sigcontext sc;
194 struct _fpstate fpstate; 196 struct _fpstate fpstate;
@@ -198,10 +200,10 @@ struct sigframe
198 200
199struct rt_sigframe 201struct rt_sigframe
200{ 202{
201 char *pretcode; 203 char __user *pretcode;
202 int sig; 204 int sig;
203 struct siginfo *pinfo; 205 struct siginfo __user *pinfo;
204 void *puc; 206 void __user *puc;
205 struct siginfo info; 207 struct siginfo info;
206 struct ucontext uc; 208 struct ucontext uc;
207 struct _fpstate fpstate; 209 struct _fpstate fpstate;
@@ -213,16 +215,16 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
213 sigset_t *mask) 215 sigset_t *mask)
214{ 216{
215 struct sigframe __user *frame; 217 struct sigframe __user *frame;
216 void *restorer; 218 void __user *restorer;
217 unsigned long save_sp = PT_REGS_SP(regs); 219 unsigned long save_sp = PT_REGS_SP(regs);
218 int err = 0; 220 int err = 0;
219 221
220 stack_top &= -8UL; 222 stack_top &= -8UL;
221 frame = (struct sigframe *) stack_top - 1; 223 frame = (struct sigframe __user *) stack_top - 1;
222 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 224 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
223 return 1; 225 return 1;
224 226
225 restorer = (void *) frame->retcode; 227 restorer = frame->retcode;
226 if(ka->sa.sa_flags & SA_RESTORER) 228 if(ka->sa.sa_flags & SA_RESTORER)
227 restorer = ka->sa.sa_restorer; 229 restorer = ka->sa.sa_restorer;
228 230
@@ -278,16 +280,16 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
278 siginfo_t *info, sigset_t *mask) 280 siginfo_t *info, sigset_t *mask)
279{ 281{
280 struct rt_sigframe __user *frame; 282 struct rt_sigframe __user *frame;
281 void *restorer; 283 void __user *restorer;
282 unsigned long save_sp = PT_REGS_SP(regs); 284 unsigned long save_sp = PT_REGS_SP(regs);
283 int err = 0; 285 int err = 0;
284 286
285 stack_top &= -8UL; 287 stack_top &= -8UL;
286 frame = (struct rt_sigframe *) stack_top - 1; 288 frame = (struct rt_sigframe __user *) stack_top - 1;
287 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 289 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
288 return 1; 290 return 1;
289 291
290 restorer = (void *) frame->retcode; 292 restorer = frame->retcode;
291 if(ka->sa.sa_flags & SA_RESTORER) 293 if(ka->sa.sa_flags & SA_RESTORER)
292 restorer = ka->sa.sa_restorer; 294 restorer = ka->sa.sa_restorer;
293 295
@@ -333,7 +335,7 @@ err:
333long sys_sigreturn(struct pt_regs regs) 335long sys_sigreturn(struct pt_regs regs)
334{ 336{
335 unsigned long sp = PT_REGS_SP(&current->thread.regs); 337 unsigned long sp = PT_REGS_SP(&current->thread.regs);
336 struct sigframe __user *frame = (struct sigframe *)(sp - 8); 338 struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
337 sigset_t set; 339 sigset_t set;
338 struct sigcontext __user *sc = &frame->sc; 340 struct sigcontext __user *sc = &frame->sc;
339 unsigned long __user *oldmask = &sc->oldmask; 341 unsigned long __user *oldmask = &sc->oldmask;
@@ -365,8 +367,8 @@ long sys_sigreturn(struct pt_regs regs)
365 367
366long sys_rt_sigreturn(struct pt_regs regs) 368long sys_rt_sigreturn(struct pt_regs regs)
367{ 369{
368 unsigned long __user sp = PT_REGS_SP(&current->thread.regs); 370 unsigned long sp = PT_REGS_SP(&current->thread.regs);
369 struct rt_sigframe __user *frame = (struct rt_sigframe *) (sp - 4); 371 struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (sp - 4);
370 sigset_t set; 372 sigset_t set;
371 struct ucontext __user *uc = &frame->uc; 373 struct ucontext __user *uc = &frame->uc;
372 int sig_size = _NSIG_WORDS * sizeof(unsigned long); 374 int sig_size = _NSIG_WORDS * sizeof(unsigned long);
diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
index 83e9be820a86..1845123ed124 100644
--- a/arch/um/sys-i386/syscalls.c
+++ b/arch/um/sys-i386/syscalls.c
@@ -104,7 +104,7 @@ long sys_ipc (uint call, int first, int second,
104 union semun fourth; 104 union semun fourth;
105 if (!ptr) 105 if (!ptr)
106 return -EINVAL; 106 return -EINVAL;
107 if (get_user(fourth.__pad, (void **) ptr)) 107 if (get_user(fourth.__pad, (void __user * __user *) ptr))
108 return -EFAULT; 108 return -EFAULT;
109 return sys_semctl (first, second, third, fourth); 109 return sys_semctl (first, second, third, fourth);
110 } 110 }