aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
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
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')
-rw-r--r--arch/um/drivers/harddog_kern.c8
-rw-r--r--arch/um/drivers/hostaudio_kern.c10
-rw-r--r--arch/um/drivers/slirp_kern.c2
-rw-r--r--arch/um/include/line.h18
-rw-r--r--arch/um/include/sysdep-i386/checksum.h5
-rw-r--r--arch/um/kernel/exec_kern.c4
-rw-r--r--arch/um/kernel/process_kern.c2
-rw-r--r--arch/um/kernel/ptrace.c34
-rw-r--r--arch/um/kernel/syscall_kern.c4
-rw-r--r--arch/um/kernel/trap_kern.c8
-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
13 files changed, 83 insertions, 90 deletions
diff --git a/arch/um/drivers/harddog_kern.c b/arch/um/drivers/harddog_kern.c
index 49acb2badf32..d18a974735e6 100644
--- a/arch/um/drivers/harddog_kern.c
+++ b/arch/um/drivers/harddog_kern.c
@@ -104,7 +104,7 @@ static int harddog_release(struct inode *inode, struct file *file)
104 104
105extern int ping_watchdog(int fd); 105extern int ping_watchdog(int fd);
106 106
107static ssize_t harddog_write(struct file *file, const char *data, size_t len, 107static ssize_t harddog_write(struct file *file, const char __user *data, size_t len,
108 loff_t *ppos) 108 loff_t *ppos)
109{ 109{
110 /* 110 /*
@@ -118,6 +118,7 @@ static ssize_t harddog_write(struct file *file, const char *data, size_t len,
118static int harddog_ioctl(struct inode *inode, struct file *file, 118static int harddog_ioctl(struct inode *inode, struct file *file,
119 unsigned int cmd, unsigned long arg) 119 unsigned int cmd, unsigned long arg)
120{ 120{
121 void __user *argp= (void __user *)arg;
121 static struct watchdog_info ident = { 122 static struct watchdog_info ident = {
122 WDIOC_SETTIMEOUT, 123 WDIOC_SETTIMEOUT,
123 0, 124 0,
@@ -127,13 +128,12 @@ static int harddog_ioctl(struct inode *inode, struct file *file,
127 default: 128 default:
128 return -ENOTTY; 129 return -ENOTTY;
129 case WDIOC_GETSUPPORT: 130 case WDIOC_GETSUPPORT:
130 if(copy_to_user((struct harddog_info *)arg, &ident, 131 if(copy_to_user(argp, &ident, sizeof(ident)))
131 sizeof(ident)))
132 return -EFAULT; 132 return -EFAULT;
133 return 0; 133 return 0;
134 case WDIOC_GETSTATUS: 134 case WDIOC_GETSTATUS:
135 case WDIOC_GETBOOTSTATUS: 135 case WDIOC_GETBOOTSTATUS:
136 return put_user(0,(int *)arg); 136 return put_user(0,(int __user *)argp);
137 case WDIOC_KEEPALIVE: 137 case WDIOC_KEEPALIVE:
138 return(ping_watchdog(harddog_out_fd)); 138 return(ping_watchdog(harddog_out_fd));
139 } 139 }
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index 59602b81b240..37232f908cd7 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -67,8 +67,8 @@ MODULE_PARM_DESC(mixer, MIXER_HELP);
67 67
68/* /dev/dsp file operations */ 68/* /dev/dsp file operations */
69 69
70static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count, 70static ssize_t hostaudio_read(struct file *file, char __user *buffer,
71 loff_t *ppos) 71 size_t count, loff_t *ppos)
72{ 72{
73 struct hostaudio_state *state = file->private_data; 73 struct hostaudio_state *state = file->private_data;
74 void *kbuf; 74 void *kbuf;
@@ -94,7 +94,7 @@ static ssize_t hostaudio_read(struct file *file, char *buffer, size_t count,
94 return(err); 94 return(err);
95} 95}
96 96
97static ssize_t hostaudio_write(struct file *file, const char *buffer, 97static ssize_t hostaudio_write(struct file *file, const char __user *buffer,
98 size_t count, loff_t *ppos) 98 size_t count, loff_t *ppos)
99{ 99{
100 struct hostaudio_state *state = file->private_data; 100 struct hostaudio_state *state = file->private_data;
@@ -152,7 +152,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
152 case SNDCTL_DSP_CHANNELS: 152 case SNDCTL_DSP_CHANNELS:
153 case SNDCTL_DSP_SUBDIVIDE: 153 case SNDCTL_DSP_SUBDIVIDE:
154 case SNDCTL_DSP_SETFRAGMENT: 154 case SNDCTL_DSP_SETFRAGMENT:
155 if(get_user(data, (int *) arg)) 155 if(get_user(data, (int __user *) arg))
156 return(-EFAULT); 156 return(-EFAULT);
157 break; 157 break;
158 default: 158 default:
@@ -168,7 +168,7 @@ static int hostaudio_ioctl(struct inode *inode, struct file *file,
168 case SNDCTL_DSP_CHANNELS: 168 case SNDCTL_DSP_CHANNELS:
169 case SNDCTL_DSP_SUBDIVIDE: 169 case SNDCTL_DSP_SUBDIVIDE:
170 case SNDCTL_DSP_SETFRAGMENT: 170 case SNDCTL_DSP_SETFRAGMENT:
171 if(put_user(data, (int *) arg)) 171 if(put_user(data, (int __user *) arg))
172 return(-EFAULT); 172 return(-EFAULT);
173 break; 173 break;
174 default: 174 default:
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index 109c541e78f2..95e50c943e14 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -77,7 +77,7 @@ static int slirp_setup(char *str, char **mac_out, void *data)
77 int i=0; 77 int i=0;
78 78
79 *init = ((struct slirp_init) 79 *init = ((struct slirp_init)
80 { argw : { { "slirp", NULL } } }); 80 { .argw = { { "slirp", NULL } } });
81 81
82 str = split_if_spec(str, mac_out, NULL); 82 str = split_if_spec(str, mac_out, NULL);
83 83
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 6f4d680dc1d4..6ac0f8252e21 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -58,23 +58,17 @@ struct line {
58}; 58};
59 59
60#define LINE_INIT(str, d) \ 60#define LINE_INIT(str, d) \
61 { init_str : str, \ 61 { .init_str = str, \
62 init_pri : INIT_STATIC, \ 62 .init_pri = INIT_STATIC, \
63 valid : 1, \ 63 .valid = 1, \
64 throttled : 0, \ 64 .lock = SPIN_LOCK_UNLOCKED, \
65 lock : SPIN_LOCK_UNLOCKED, \ 65 .driver = d }
66 buffer : NULL, \
67 head : NULL, \
68 tail : NULL, \
69 sigio : 0, \
70 driver : d, \
71 have_irq : 0 }
72 66
73struct lines { 67struct lines {
74 int num; 68 int num;
75}; 69};
76 70
77#define LINES_INIT(n) { num : n } 71#define LINES_INIT(n) { .num = n }
78 72
79extern void line_close(struct tty_struct *tty, struct file * filp); 73extern void line_close(struct tty_struct *tty, struct file * filp);
80extern int line_open(struct line *lines, struct tty_struct *tty); 74extern int line_open(struct line *lines, struct tty_struct *tty);
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
index 7d3d202d7fff..052bb061a978 100644
--- a/arch/um/include/sysdep-i386/checksum.h
+++ b/arch/um/include/sysdep-i386/checksum.h
@@ -48,7 +48,8 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *
48 */ 48 */
49 49
50static __inline__ 50static __inline__
51unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, 51unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
52 unsigned char *dst,
52 int len, int sum, int *err_ptr) 53 int len, int sum, int *err_ptr)
53{ 54{
54 if(copy_from_user(dst, src, len)){ 55 if(copy_from_user(dst, src, len)){
@@ -192,7 +193,7 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
192 */ 193 */
193#define HAVE_CSUM_COPY_USER 194#define HAVE_CSUM_COPY_USER
194static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src, 195static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
195 unsigned char *dst, 196 unsigned char __user *dst,
196 int len, int sum, int *err_ptr) 197 int len, int sum, int *err_ptr)
197{ 198{
198 if (access_ok(VERIFY_WRITE, dst, len)){ 199 if (access_ok(VERIFY_WRITE, dst, len)){
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c
index 1ca84319317d..f9b346e05b00 100644
--- a/arch/um/kernel/exec_kern.c
+++ b/arch/um/kernel/exec_kern.c
@@ -58,14 +58,14 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
58 return(err); 58 return(err);
59} 59}
60 60
61long sys_execve(char *file, char __user *__user *argv, 61long sys_execve(char __user *file, char __user *__user *argv,
62 char __user *__user *env) 62 char __user *__user *env)
63{ 63{
64 long error; 64 long error;
65 char *filename; 65 char *filename;
66 66
67 lock_kernel(); 67 lock_kernel();
68 filename = getname((char __user *) file); 68 filename = getname(file);
69 error = PTR_ERR(filename); 69 error = PTR_ERR(filename);
70 if (IS_ERR(filename)) goto out; 70 if (IS_ERR(filename)) goto out;
71 error = execve1(filename, argv, env); 71 error = execve1(filename, argv, env);
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index 3113cab8675e..6922bdfb5ad5 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -407,7 +407,7 @@ static int proc_read_sysemu(char *buf, char **start, off_t offset, int size,int
407 return strlen(buf); 407 return strlen(buf);
408} 408}
409 409
410static int proc_write_sysemu(struct file *file,const char *buf, unsigned long count,void *data) 410static int proc_write_sysemu(struct file *file,const char __user *buf, unsigned long count,void *data)
411{ 411{
412 char tmp[2]; 412 char tmp[2];
413 413
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 98e09395c093..394582202ce6 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -46,6 +46,7 @@ extern int poke_user(struct task_struct * child, long addr, long data);
46long arch_ptrace(struct task_struct *child, long request, long addr, long data) 46long arch_ptrace(struct task_struct *child, long request, long addr, long data)
47{ 47{
48 int i, ret; 48 int i, ret;
49 unsigned long __user *p = (void __user *)(unsigned long)data;
49 50
50 switch (request) { 51 switch (request) {
51 /* when I and D space are separate, these will need to be fixed. */ 52 /* when I and D space are separate, these will need to be fixed. */
@@ -58,7 +59,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
58 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0); 59 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
59 if (copied != sizeof(tmp)) 60 if (copied != sizeof(tmp))
60 break; 61 break;
61 ret = put_user(tmp, (unsigned long __user *) data); 62 ret = put_user(tmp, p);
62 break; 63 break;
63 } 64 }
64 65
@@ -136,15 +137,13 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
136 137
137#ifdef PTRACE_GETREGS 138#ifdef PTRACE_GETREGS
138 case PTRACE_GETREGS: { /* Get all gp regs from the child. */ 139 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
139 if (!access_ok(VERIFY_WRITE, (unsigned long *)data, 140 if (!access_ok(VERIFY_WRITE, p, MAX_REG_OFFSET)) {
140 MAX_REG_OFFSET)) {
141 ret = -EIO; 141 ret = -EIO;
142 break; 142 break;
143 } 143 }
144 for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { 144 for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
145 __put_user(getreg(child, i), 145 __put_user(getreg(child, i), p);
146 (unsigned long __user *) data); 146 p++;
147 data += sizeof(long);
148 } 147 }
149 ret = 0; 148 ret = 0;
150 break; 149 break;
@@ -153,15 +152,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
153#ifdef PTRACE_SETREGS 152#ifdef PTRACE_SETREGS
154 case PTRACE_SETREGS: { /* Set all gp regs in the child. */ 153 case PTRACE_SETREGS: { /* Set all gp regs in the child. */
155 unsigned long tmp = 0; 154 unsigned long tmp = 0;
156 if (!access_ok(VERIFY_READ, (unsigned *)data, 155 if (!access_ok(VERIFY_READ, p, MAX_REG_OFFSET)) {
157 MAX_REG_OFFSET)) {
158 ret = -EIO; 156 ret = -EIO;
159 break; 157 break;
160 } 158 }
161 for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) { 159 for ( i = 0; i < MAX_REG_OFFSET; i += sizeof(long) ) {
162 __get_user(tmp, (unsigned long __user *) data); 160 __get_user(tmp, p);
163 putreg(child, i, tmp); 161 putreg(child, i, tmp);
164 data += sizeof(long); 162 p++;
165 } 163 }
166 ret = 0; 164 ret = 0;
167 break; 165 break;
@@ -188,13 +186,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
188 break; 186 break;
189#endif 187#endif
190 case PTRACE_FAULTINFO: { 188 case PTRACE_FAULTINFO: {
191 /* Take the info from thread->arch->faultinfo, 189 /* Take the info from thread->arch->faultinfo,
192 * but transfer max. sizeof(struct ptrace_faultinfo). 190 * but transfer max. sizeof(struct ptrace_faultinfo).
193 * On i386, ptrace_faultinfo is smaller! 191 * On i386, ptrace_faultinfo is smaller!
194 */ 192 */
195 ret = copy_to_user((unsigned long __user *) data, 193 ret = copy_to_user(p, &child->thread.arch.faultinfo,
196 &child->thread.arch.faultinfo, 194 sizeof(struct ptrace_faultinfo));
197 sizeof(struct ptrace_faultinfo));
198 if(ret) 195 if(ret)
199 break; 196 break;
200 break; 197 break;
@@ -204,8 +201,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
204 case PTRACE_LDT: { 201 case PTRACE_LDT: {
205 struct ptrace_ldt ldt; 202 struct ptrace_ldt ldt;
206 203
207 if(copy_from_user(&ldt, (unsigned long __user *) data, 204 if(copy_from_user(&ldt, p, sizeof(ldt))){
208 sizeof(ldt))){
209 ret = -EIO; 205 ret = -EIO;
210 break; 206 break;
211 } 207 }
diff --git a/arch/um/kernel/syscall_kern.c b/arch/um/kernel/syscall_kern.c
index 8e1a3501ff46..37d3978337d8 100644
--- a/arch/um/kernel/syscall_kern.c
+++ b/arch/um/kernel/syscall_kern.c
@@ -104,7 +104,7 @@ long sys_pipe(unsigned long __user * fildes)
104} 104}
105 105
106 106
107long sys_uname(struct old_utsname * name) 107long sys_uname(struct old_utsname __user * name)
108{ 108{
109 long err; 109 long err;
110 if (!name) 110 if (!name)
@@ -115,7 +115,7 @@ long sys_uname(struct old_utsname * name)
115 return err?-EFAULT:0; 115 return err?-EFAULT:0;
116} 116}
117 117
118long sys_olduname(struct oldold_utsname * name) 118long sys_olduname(struct oldold_utsname __user * name)
119{ 119{
120 long error; 120 long error;
121 121
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index d56046c2aba2..02f6d4d8dc3a 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -198,7 +198,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
198 si.si_signo = SIGBUS; 198 si.si_signo = SIGBUS;
199 si.si_errno = 0; 199 si.si_errno = 0;
200 si.si_code = BUS_ADRERR; 200 si.si_code = BUS_ADRERR;
201 si.si_addr = (void *)address; 201 si.si_addr = (void __user *)address;
202 current->thread.arch.faultinfo = fi; 202 current->thread.arch.faultinfo = fi;
203 force_sig_info(SIGBUS, &si, current); 203 force_sig_info(SIGBUS, &si, current);
204 } else if (err == -ENOMEM) { 204 } else if (err == -ENOMEM) {
@@ -207,7 +207,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, void *sc)
207 } else { 207 } else {
208 BUG_ON(err != -EFAULT); 208 BUG_ON(err != -EFAULT);
209 si.si_signo = SIGSEGV; 209 si.si_signo = SIGSEGV;
210 si.si_addr = (void *) address; 210 si.si_addr = (void __user *) address;
211 current->thread.arch.faultinfo = fi; 211 current->thread.arch.faultinfo = fi;
212 force_sig_info(SIGSEGV, &si, current); 212 force_sig_info(SIGSEGV, &si, current);
213 } 213 }
@@ -220,8 +220,8 @@ void bad_segv(struct faultinfo fi, unsigned long ip)
220 220
221 si.si_signo = SIGSEGV; 221 si.si_signo = SIGSEGV;
222 si.si_code = SEGV_ACCERR; 222 si.si_code = SEGV_ACCERR;
223 si.si_addr = (void *) FAULT_ADDRESS(fi); 223 si.si_addr = (void __user *) FAULT_ADDRESS(fi);
224 current->thread.arch.faultinfo = fi; 224 current->thread.arch.faultinfo = fi;
225 force_sig_info(SIGSEGV, &si, current); 225 force_sig_info(SIGSEGV, &si, current);
226} 226}
227 227
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 }