diff options
author | Arnd Bergmann <arnd@arndb.de> | 2009-06-27 09:05:30 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2009-06-27 09:09:52 -0400 |
commit | a1f8213b9518d0e9124a48a34bdd58b4bc2650e5 (patch) | |
tree | 07de0c44f8e30fb6da6458b6026c3114740ea9bc /arch/score/kernel | |
parent | 9fb24cc50045ec8d13d0a6c3d4d454750b466d61 (diff) |
score: add address space annotations
Annotate the address space for pointers that are used
correctly with __user and __iomem, so that sparse
can better warn about incorrect casts.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/score/kernel')
-rw-r--r-- | arch/score/kernel/ptrace.c | 7 | ||||
-rw-r--r-- | arch/score/kernel/signal.c | 10 | ||||
-rw-r--r-- | arch/score/kernel/sys_score.c | 9 |
3 files changed, 14 insertions, 12 deletions
diff --git a/arch/score/kernel/ptrace.c b/arch/score/kernel/ptrace.c index 19911e3187be..1db876b11476 100644 --- a/arch/score/kernel/ptrace.c +++ b/arch/score/kernel/ptrace.c | |||
@@ -267,6 +267,7 @@ long | |||
267 | arch_ptrace(struct task_struct *child, long request, long addr, long data) | 267 | arch_ptrace(struct task_struct *child, long request, long addr, long data) |
268 | { | 268 | { |
269 | int ret; | 269 | int ret; |
270 | unsigned long __user *datap = (void __user *)data; | ||
270 | 271 | ||
271 | switch (request) { | 272 | switch (request) { |
272 | /* Read the word at location addr in the USER area. */ | 273 | /* Read the word at location addr in the USER area. */ |
@@ -316,7 +317,7 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
316 | return -EIO; | 317 | return -EIO; |
317 | } | 318 | } |
318 | 319 | ||
319 | ret = put_user(tmp, (unsigned long *) data); | 320 | ret = put_user(tmp, (unsigned int __user *) datap); |
320 | return ret; | 321 | return ret; |
321 | } | 322 | } |
322 | 323 | ||
@@ -355,11 +356,11 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
355 | } | 356 | } |
356 | 357 | ||
357 | case PTRACE_GETREGS: | 358 | case PTRACE_GETREGS: |
358 | ret = ptrace_getregs(child, (void __user *)data); | 359 | ret = ptrace_getregs(child, (void __user *)datap); |
359 | break; | 360 | break; |
360 | 361 | ||
361 | case PTRACE_SETREGS: | 362 | case PTRACE_SETREGS: |
362 | ret = ptrace_setregs(child, (void __user *)data); | 363 | ret = ptrace_setregs(child, (void __user *)datap); |
363 | break; | 364 | break; |
364 | 365 | ||
365 | default: | 366 | default: |
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c index 252f6d95ad9e..1634aaa7c2ba 100644 --- a/arch/score/kernel/signal.c +++ b/arch/score/kernel/signal.c | |||
@@ -131,13 +131,13 @@ void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, | |||
131 | if ((ka->sa.sa_flags & SA_ONSTACK) && (!on_sig_stack(sp))) | 131 | if ((ka->sa.sa_flags & SA_ONSTACK) && (!on_sig_stack(sp))) |
132 | sp = current->sas_ss_sp + current->sas_ss_size; | 132 | sp = current->sas_ss_sp + current->sas_ss_size; |
133 | 133 | ||
134 | return (void *)((sp - frame_size) & ~7); | 134 | return (void __user*)((sp - frame_size) & ~7); |
135 | } | 135 | } |
136 | 136 | ||
137 | int score_sigaltstack(struct pt_regs *regs) | 137 | int score_sigaltstack(struct pt_regs *regs) |
138 | { | 138 | { |
139 | const stack_t *uss = (const stack_t *) regs->regs[4]; | 139 | const stack_t __user *uss = (const stack_t __user *) regs->regs[4]; |
140 | stack_t *uoss = (stack_t *) regs->regs[5]; | 140 | stack_t __user *uoss = (stack_t __user *) regs->regs[5]; |
141 | unsigned long usp = regs->regs[0]; | 141 | unsigned long usp = regs->regs[0]; |
142 | 142 | ||
143 | return do_sigaltstack(uss, uoss, usp); | 143 | return do_sigaltstack(uss, uoss, usp); |
@@ -188,7 +188,7 @@ badframe: | |||
188 | int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | 188 | int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, |
189 | int signr, sigset_t *set, siginfo_t *info) | 189 | int signr, sigset_t *set, siginfo_t *info) |
190 | { | 190 | { |
191 | struct rt_sigframe *frame; | 191 | struct rt_sigframe __user *frame; |
192 | int err = 0; | 192 | int err = 0; |
193 | 193 | ||
194 | frame = get_sigframe(ka, regs, sizeof(*frame)); | 194 | frame = get_sigframe(ka, regs, sizeof(*frame)); |
@@ -209,7 +209,7 @@ int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
209 | err |= copy_siginfo_to_user(&frame->rs_info, info); | 209 | err |= copy_siginfo_to_user(&frame->rs_info, info); |
210 | err |= __put_user(0, &frame->rs_uc.uc_flags); | 210 | err |= __put_user(0, &frame->rs_uc.uc_flags); |
211 | err |= __put_user(0, &frame->rs_uc.uc_link); | 211 | err |= __put_user(0, &frame->rs_uc.uc_link); |
212 | err |= __put_user((void *)current->sas_ss_sp, | 212 | err |= __put_user((void __user *)current->sas_ss_sp, |
213 | &frame->rs_uc.uc_stack.ss_sp); | 213 | &frame->rs_uc.uc_stack.ss_sp); |
214 | err |= __put_user(sas_ss_flags(regs->regs[0]), | 214 | err |= __put_user(sas_ss_flags(regs->regs[0]), |
215 | &frame->rs_uc.uc_stack.ss_flags); | 215 | &frame->rs_uc.uc_stack.ss_flags); |
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c index eb4d2d3b97ad..16ace29935bb 100644 --- a/arch/score/kernel/sys_score.c +++ b/arch/score/kernel/sys_score.c | |||
@@ -87,18 +87,19 @@ int score_clone(struct pt_regs *regs) | |||
87 | * sys_execve() executes a new program. | 87 | * sys_execve() executes a new program. |
88 | * This is called indirectly via a small wrapper | 88 | * This is called indirectly via a small wrapper |
89 | */ | 89 | */ |
90 | int score_execve(struct pt_regs *regs) | 90 | asmlinkage long |
91 | score_execve(struct pt_regs *regs) | ||
91 | { | 92 | { |
92 | int error; | 93 | int error; |
93 | char *filename; | 94 | char *filename; |
94 | 95 | ||
95 | filename = getname((char *) (long) regs->regs[4]); | 96 | filename = getname((char __user*)regs->regs[4]); |
96 | error = PTR_ERR(filename); | 97 | error = PTR_ERR(filename); |
97 | if (IS_ERR(filename)) | 98 | if (IS_ERR(filename)) |
98 | return error; | 99 | return error; |
99 | 100 | ||
100 | error = do_execve(filename, (char **) (long) regs->regs[5], | 101 | error = do_execve(filename, (char __user *__user*)regs->regs[5], |
101 | (char **) (long) regs->regs[6], regs); | 102 | (char __user *__user *) regs->regs[6], regs); |
102 | 103 | ||
103 | putname(filename); | 104 | putname(filename); |
104 | return error; | 105 | return error; |