From: Jesper Juhl 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: Jesper Juhl Signed-off-by: Andrew Morton --- 25-akpm/arch/sparc/kernel/ptrace.c | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) diff -puN arch/sparc/kernel/ptrace.c~arch_sparc_kernel_ptrace-pointless-assignment-and-shadowed-varpatch arch/sparc/kernel/ptrace.c --- 25/arch/sparc/kernel/ptrace.c~arch_sparc_kernel_ptrace-pointless-assignment-and-shadowed-varpatch 2005-03-06 20:55:40.000000000 -0800 +++ 25-akpm/arch/sparc/kernel/ptrace.c 2005-03-06 20:55:40.000000000 -0800 @@ -285,17 +285,17 @@ asmlinkage void do_ptrace(struct pt_regs s, (int) request, (int) pid, addr, data, addr2); } #endif - if(request == PTRACE_TRACEME) { - int ret; + if (request == PTRACE_TRACEME) { + int my_ret; /* are we already being traced? */ if (current->ptrace & PT_PTRACED) { pt_error_return(regs, EPERM); goto out; } - ret = security_ptrace(current->parent, current); - if (ret) { - pt_error_return(regs, -ret); + my_ret = security_ptrace(current->parent, current); + if (my_ret) { + pt_error_return(regs, -my_ret); goto out; } @@ -305,7 +305,7 @@ asmlinkage void do_ptrace(struct pt_regs goto out; } #ifndef ALLOW_INIT_TRACING - if(pid == 1) { + if (pid == 1) { /* Can't dork with init. */ pt_error_return(regs, EPERM); goto out; @@ -402,8 +402,7 @@ asmlinkage void do_ptrace(struct pt_regs * bits in the psr. */ if (!access_ok(VERIFY_READ, pregs, sizeof(struct pt_regs))) { - i = -EFAULT; - pt_error_return(regs, -i); + pt_error_return(regs, EFAULT); goto out_tsk; } __get_user(psr, (&pregs->psr)); @@ -413,7 +412,7 @@ asmlinkage void do_ptrace(struct pt_regs psr &= PSR_ICC; cregs->psr &= ~PSR_ICC; cregs->psr |= psr; - if(!((pc | npc) & 3)) { + if (!((pc | npc) & 3)) { cregs->pc = pc; cregs->npc =npc; } _