aboutsummaryrefslogtreecommitdiff
path: root/arch/cris/arch-v32/kernel
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-27 15:33:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 18:03:10 -0700
commit475a4b813816fe9af4cdf7833799036b679f46d0 (patch)
tree8147812d582934768f7425c415e14019901ff302 /arch/cris/arch-v32/kernel
parentaeebd3a3d9f5b67a254f04e6eac91a74c5e1065e (diff)
ptrace: cleanup arch_ptrace() on cris
Use new 'regno' variable in order to remove redandunt expression and remove checking @addr less than 0 because @addr is now unsigned. Also update 'datap' on PTRACE_GET/SETREGS to fix a bug on arch-v10. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Acked-by: Mikael Starvik <starvik@axis.com> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/cris/arch-v32/kernel')
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 3e058a12175..511ece94a57 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -130,6 +130,7 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data)
{
int ret;
+ unsigned int regno = addr >> 2;
unsigned long __user *datap = (unsigned long __user *)data;
switch (request) {
@@ -164,10 +165,10 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long tmp;
ret = -EIO;
- if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+ if ((addr & 3) || regno > PT_MAX)
break;
- tmp = get_reg(child, addr >> 2);
+ tmp = get_reg(child, regno);
ret = put_user(tmp, datap);
break;
}
@@ -181,19 +182,17 @@ long arch_ptrace(struct task_struct *child, long request,
/* Write the word at location address in the USER area. */
case PTRACE_POKEUSR:
ret = -EIO;
- if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
+ if ((addr & 3) || regno > PT_MAX)
break;
- addr >>= 2;
-
- if (addr == PT_CCS) {
+ if (regno == PT_CCS) {
/* don't allow the tracing process to change stuff like
* interrupt enable, kernel/user bit, dma enables etc.
*/
data &= CCS_MASK;
data |= get_reg(child, PT_CCS) & ~CCS_MASK;
}
- if (put_reg(child, addr, data))
+ if (put_reg(child, regno, data))
break;
ret = 0;
break;