aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300/kernel
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-27 18:33:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:11 -0400
commit261bb92054b9e0835c176a27967dd9eb326d010c (patch)
tree2ec294c3a859b8acfab929fb1d97793801ce6da8 /arch/mn10300/kernel
parentfb671139a27abc44303ef938c3811d910724c493 (diff)
ptrace: cleanup arch_ptrace() on mn10300
Use new 'datap' variable in order to remove unnecessary castings. Also remove checking @addr less than 0 because @addr is now unsigned. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Cc: David Howells <dhowells@redhat.com> Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300/kernel')
-rw-r--r--arch/mn10300/kernel/ptrace.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/arch/mn10300/kernel/ptrace.c b/arch/mn10300/kernel/ptrace.c
index ec4b41439e99..5c0b07e61006 100644
--- a/arch/mn10300/kernel/ptrace.c
+++ b/arch/mn10300/kernel/ptrace.c
@@ -300,27 +300,26 @@ long arch_ptrace(struct task_struct *child, long request,
300{ 300{
301 unsigned long tmp; 301 unsigned long tmp;
302 int ret; 302 int ret;
303 unsigned long __user *datap = (unsigned long __user *) data;
303 304
304 switch (request) { 305 switch (request) {
305 /* read the word at location addr in the USER area. */ 306 /* read the word at location addr in the USER area. */
306 case PTRACE_PEEKUSR: 307 case PTRACE_PEEKUSR:
307 ret = -EIO; 308 ret = -EIO;
308 if ((addr & 3) || addr < 0 || 309 if ((addr & 3) || addr > sizeof(struct user) - 3)
309 addr > sizeof(struct user) - 3)
310 break; 310 break;
311 311
312 tmp = 0; /* Default return condition */ 312 tmp = 0; /* Default return condition */
313 if (addr < NR_PTREGS << 2) 313 if (addr < NR_PTREGS << 2)
314 tmp = get_stack_long(child, 314 tmp = get_stack_long(child,
315 ptrace_regid_to_frame[addr]); 315 ptrace_regid_to_frame[addr]);
316 ret = put_user(tmp, (unsigned long *) data); 316 ret = put_user(tmp, datap);
317 break; 317 break;
318 318
319 /* write the word at location addr in the USER area */ 319 /* write the word at location addr in the USER area */
320 case PTRACE_POKEUSR: 320 case PTRACE_POKEUSR:
321 ret = -EIO; 321 ret = -EIO;
322 if ((addr & 3) || addr < 0 || 322 if ((addr & 3) || addr > sizeof(struct user) - 3)
323 addr > sizeof(struct user) - 3)
324 break; 323 break;
325 324
326 ret = 0; 325 ret = 0;
@@ -333,25 +332,25 @@ long arch_ptrace(struct task_struct *child, long request,
333 return copy_regset_to_user(child, &user_mn10300_native_view, 332 return copy_regset_to_user(child, &user_mn10300_native_view,
334 REGSET_GENERAL, 333 REGSET_GENERAL,
335 0, NR_PTREGS * sizeof(long), 334 0, NR_PTREGS * sizeof(long),
336 (void __user *)data); 335 datap);
337 336
338 case PTRACE_SETREGS: /* Set all integer regs in the child. */ 337 case PTRACE_SETREGS: /* Set all integer regs in the child. */
339 return copy_regset_from_user(child, &user_mn10300_native_view, 338 return copy_regset_from_user(child, &user_mn10300_native_view,
340 REGSET_GENERAL, 339 REGSET_GENERAL,
341 0, NR_PTREGS * sizeof(long), 340 0, NR_PTREGS * sizeof(long),
342 (const void __user *)data); 341 datap);
343 342
344 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 343 case PTRACE_GETFPREGS: /* Get the child FPU state. */
345 return copy_regset_to_user(child, &user_mn10300_native_view, 344 return copy_regset_to_user(child, &user_mn10300_native_view,
346 REGSET_FPU, 345 REGSET_FPU,
347 0, sizeof(struct fpu_state_struct), 346 0, sizeof(struct fpu_state_struct),
348 (void __user *)data); 347 datap);
349 348
350 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 349 case PTRACE_SETFPREGS: /* Set the child FPU state. */
351 return copy_regset_from_user(child, &user_mn10300_native_view, 350 return copy_regset_from_user(child, &user_mn10300_native_view,
352 REGSET_FPU, 351 REGSET_FPU,
353 0, sizeof(struct fpu_state_struct), 352 0, sizeof(struct fpu_state_struct),
354 (const void __user *)data); 353 datap);
355 354
356 default: 355 default:
357 ret = ptrace_request(child, request, addr, data); 356 ret = ptrace_request(child, request, addr, data);