summaryrefslogtreecommitdiffstats
path: root/arch/score/kernel
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-06-27 15:05:30 +0200
committerArnd Bergmann <arnd@arndb.de>2009-06-27 15:09:52 +0200
commita1f8213b9518d0e9124a48a34bdd58b4bc2650e5 (patch)
tree07de0c44f8e30fb6da6458b6026c3114740ea9bc /arch/score/kernel
parent9fb24cc50045ec8d13d0a6c3d4d454750b466d61 (diff)
downloadop-kernel-dev-a1f8213b9518d0e9124a48a34bdd58b4bc2650e5.zip
op-kernel-dev-a1f8213b9518d0e9124a48a34bdd58b4bc2650e5.tar.gz
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.c7
-rw-r--r--arch/score/kernel/signal.c10
-rw-r--r--arch/score/kernel/sys_score.c9
3 files changed, 14 insertions, 12 deletions
diff --git a/arch/score/kernel/ptrace.c b/arch/score/kernel/ptrace.c
index 19911e3..1db876b 100644
--- a/arch/score/kernel/ptrace.c
+++ b/arch/score/kernel/ptrace.c
@@ -267,6 +267,7 @@ long
arch_ptrace(struct task_struct *child, long request, long addr, long data)
{
int ret;
+ unsigned long __user *datap = (void __user *)data;
switch (request) {
/* 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)
return -EIO;
}
- ret = put_user(tmp, (unsigned long *) data);
+ ret = put_user(tmp, (unsigned int __user *) datap);
return ret;
}
@@ -355,11 +356,11 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
}
case PTRACE_GETREGS:
- ret = ptrace_getregs(child, (void __user *)data);
+ ret = ptrace_getregs(child, (void __user *)datap);
break;
case PTRACE_SETREGS:
- ret = ptrace_setregs(child, (void __user *)data);
+ ret = ptrace_setregs(child, (void __user *)datap);
break;
default:
diff --git a/arch/score/kernel/signal.c b/arch/score/kernel/signal.c
index 252f6d9..1634aaa 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,
if ((ka->sa.sa_flags & SA_ONSTACK) && (!on_sig_stack(sp)))
sp = current->sas_ss_sp + current->sas_ss_size;
- return (void *)((sp - frame_size) & ~7);
+ return (void __user*)((sp - frame_size) & ~7);
}
int score_sigaltstack(struct pt_regs *regs)
{
- const stack_t *uss = (const stack_t *) regs->regs[4];
- stack_t *uoss = (stack_t *) regs->regs[5];
+ const stack_t __user *uss = (const stack_t __user *) regs->regs[4];
+ stack_t __user *uoss = (stack_t __user *) regs->regs[5];
unsigned long usp = regs->regs[0];
return do_sigaltstack(uss, uoss, usp);
@@ -188,7 +188,7 @@ badframe:
int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
int signr, sigset_t *set, siginfo_t *info)
{
- struct rt_sigframe *frame;
+ struct rt_sigframe __user *frame;
int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
@@ -209,7 +209,7 @@ int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
err |= copy_siginfo_to_user(&frame->rs_info, info);
err |= __put_user(0, &frame->rs_uc.uc_flags);
err |= __put_user(0, &frame->rs_uc.uc_link);
- err |= __put_user((void *)current->sas_ss_sp,
+ err |= __put_user((void __user *)current->sas_ss_sp,
&frame->rs_uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(regs->regs[0]),
&frame->rs_uc.uc_stack.ss_flags);
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index eb4d2d3..16ace29 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)
* sys_execve() executes a new program.
* This is called indirectly via a small wrapper
*/
-int score_execve(struct pt_regs *regs)
+asmlinkage long
+score_execve(struct pt_regs *regs)
{
int error;
char *filename;
- filename = getname((char *) (long) regs->regs[4]);
+ filename = getname((char __user*)regs->regs[4]);
error = PTR_ERR(filename);
if (IS_ERR(filename))
return error;
- error = do_execve(filename, (char **) (long) regs->regs[5],
- (char **) (long) regs->regs[6], regs);
+ error = do_execve(filename, (char __user *__user*)regs->regs[5],
+ (char __user *__user *) regs->regs[6], regs);
putname(filename);
return error;
OpenPOWER on IntegriCloud