diff options
Diffstat (limited to 'arch/parisc/kernel/ptrace.c')
-rw-r--r-- | arch/parisc/kernel/ptrace.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 90904f9dfc50..927db3668b6f 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -183,10 +183,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
183 | * being 64 bit in both cases. | 183 | * being 64 bit in both cases. |
184 | */ | 184 | */ |
185 | 185 | ||
186 | static long translate_usr_offset(long offset) | 186 | static compat_ulong_t translate_usr_offset(compat_ulong_t offset) |
187 | { | 187 | { |
188 | if (offset < 0) | 188 | if (offset < 0) |
189 | return -1; | 189 | return sizeof(struct pt_regs); |
190 | else if (offset <= 32*4) /* gr[0..31] */ | 190 | else if (offset <= 32*4) /* gr[0..31] */ |
191 | return offset * 2 + 4; | 191 | return offset * 2 + 4; |
192 | else if (offset <= 32*4+32*8) /* gr[0..31] + fr[0..31] */ | 192 | else if (offset <= 32*4+32*8) /* gr[0..31] + fr[0..31] */ |
@@ -194,7 +194,7 @@ static long translate_usr_offset(long offset) | |||
194 | else if (offset < sizeof(struct pt_regs)/2 + 32*4) | 194 | else if (offset < sizeof(struct pt_regs)/2 + 32*4) |
195 | return offset * 2 + 4 - 32*8; | 195 | return offset * 2 + 4 - 32*8; |
196 | else | 196 | else |
197 | return -1; | 197 | return sizeof(struct pt_regs); |
198 | } | 198 | } |
199 | 199 | ||
200 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | 200 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
@@ -209,7 +209,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
209 | if (addr & (sizeof(compat_uint_t)-1)) | 209 | if (addr & (sizeof(compat_uint_t)-1)) |
210 | break; | 210 | break; |
211 | addr = translate_usr_offset(addr); | 211 | addr = translate_usr_offset(addr); |
212 | if (addr < 0) | 212 | if (addr >= sizeof(struct pt_regs)) |
213 | break; | 213 | break; |
214 | 214 | ||
215 | tmp = *(compat_uint_t *) ((char *) task_regs(child) + addr); | 215 | tmp = *(compat_uint_t *) ((char *) task_regs(child) + addr); |
@@ -236,7 +236,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
236 | if (addr & (sizeof(compat_uint_t)-1)) | 236 | if (addr & (sizeof(compat_uint_t)-1)) |
237 | break; | 237 | break; |
238 | addr = translate_usr_offset(addr); | 238 | addr = translate_usr_offset(addr); |
239 | if (addr < 0) | 239 | if (addr >= sizeof(struct pt_regs)) |
240 | break; | 240 | break; |
241 | if (addr >= PT_FR0 && addr <= PT_FR31 + 4) { | 241 | if (addr >= PT_FR0 && addr <= PT_FR31 + 4) { |
242 | /* Special case, fp regs are 64 bits anyway */ | 242 | /* Special case, fp regs are 64 bits anyway */ |