Commit 2425d5f4 authored by Jesper Juhl's avatar Jesper Juhl Committed by Linus Torvalds

[PATCH] arch/sparc/kernel/ptrace: pointless assignment and shadowed var

A few tiny cleanups for arch/sparc/kernel/ptrace.c::do_ptrace post the big
verify_area/access_ok cleanup.

'ret' shadows a variable of the same name in the enclosing scope, rename it.

The assignment of -EFAULT to 'i' exactely mirrors what the old verify_area
code did, but that was only to use 'i' to check the return value of
verify_area.  Now that we check access_ok directly and 'i' is initialized in
the for loop a few lines below anyway, the asignment of -EFAULT to i is bogus,
just pass pass EFAULT directly as the second arg to pt_error_return. 

Also a few tiny whitespace cleanups - 'if ()' vs 'if()'.
Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dd96701c
...@@ -285,17 +285,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -285,17 +285,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
s, (int) request, (int) pid, addr, data, addr2); s, (int) request, (int) pid, addr, data, addr2);
} }
#endif #endif
if(request == PTRACE_TRACEME) { if (request == PTRACE_TRACEME) {
int ret; int my_ret;
/* are we already being traced? */ /* are we already being traced? */
if (current->ptrace & PT_PTRACED) { if (current->ptrace & PT_PTRACED) {
pt_error_return(regs, EPERM); pt_error_return(regs, EPERM);
goto out; goto out;
} }
ret = security_ptrace(current->parent, current); my_ret = security_ptrace(current->parent, current);
if (ret) { if (my_ret) {
pt_error_return(regs, -ret); pt_error_return(regs, -my_ret);
goto out; goto out;
} }
...@@ -305,7 +305,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -305,7 +305,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
goto out; goto out;
} }
#ifndef ALLOW_INIT_TRACING #ifndef ALLOW_INIT_TRACING
if(pid == 1) { if (pid == 1) {
/* Can't dork with init. */ /* Can't dork with init. */
pt_error_return(regs, EPERM); pt_error_return(regs, EPERM);
goto out; goto out;
...@@ -402,8 +402,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -402,8 +402,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
* bits in the psr. * bits in the psr.
*/ */
if (!access_ok(VERIFY_READ, pregs, sizeof(struct pt_regs))) { if (!access_ok(VERIFY_READ, pregs, sizeof(struct pt_regs))) {
i = -EFAULT; pt_error_return(regs, EFAULT);
pt_error_return(regs, -i);
goto out_tsk; goto out_tsk;
} }
__get_user(psr, (&pregs->psr)); __get_user(psr, (&pregs->psr));
...@@ -413,7 +412,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -413,7 +412,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
psr &= PSR_ICC; psr &= PSR_ICC;
cregs->psr &= ~PSR_ICC; cregs->psr &= ~PSR_ICC;
cregs->psr |= psr; cregs->psr |= psr;
if(!((pc | npc) & 3)) { if (!((pc | npc) & 3)) {
cregs->pc = pc; cregs->pc = pc;
cregs->npc =npc; cregs->npc =npc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment