|
@@ -80,6 +80,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) {
|
|
@@ -94,10 +95,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;
|
|
|
}
|
|
@@ -111,19 +112,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_DCCR) {
|
|
|
+ if (regno == PT_DCCR) {
|
|
|
/* don't allow the tracing process to change stuff like
|
|
|
* interrupt enable, kernel/user bit, dma enables etc.
|
|
|
*/
|
|
|
data &= DCCR_MASK;
|
|
|
data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
|
|
|
}
|
|
|
- if (put_reg(child, addr, data))
|
|
|
+ if (put_reg(child, regno, data))
|
|
|
break;
|
|
|
ret = 0;
|
|
|
break;
|
|
@@ -142,7 +141,7 @@ long arch_ptrace(struct task_struct *child, long request,
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- data += sizeof(unsigned long);
|
|
|
+ datap++;
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -166,7 +165,7 @@ long arch_ptrace(struct task_struct *child, long request,
|
|
|
}
|
|
|
|
|
|
put_reg(child, i, tmp);
|
|
|
- data += sizeof(unsigned long);
|
|
|
+ datap++;
|
|
|
}
|
|
|
|
|
|
break;
|