| From | Arnd Bergmann <> | Subject | Re: [RFC PATCH 02/43] ptrace: cleanup ptrace_request() | Date | Fri, 27 Aug 2010 16:23:01 +0200 |
| |
On Friday 27 August 2010, Namhyung Kim wrote: > @@ -579,19 +580,19 @@ int ptrace_request(struct task_struct *child, long request, > ret = ptrace_setoptions(child, data); > break; > case PTRACE_GETEVENTMSG: > - ret = put_user(child->ptrace_message, (unsigned long __user *) data); > + ret = copy_to_user(datap, &child->ptrace_message, > + sizeof (child->ptrace_message)) ? > + -EFAULT : 0; > break; > > case PTRACE_GETSIGINFO: > ret = ptrace_getsiginfo(child, &siginfo); > if (!ret) > - ret = copy_siginfo_to_user((siginfo_t __user *) data, > - &siginfo); > + ret = copy_siginfo_to_user(datap, &siginfo); > break;
If you introduce two pointers, 'siginfo_t __user *usiginfo' and 'unsigned long __user *datap' instead of just 'datap', you can use get_user/put_user everywhere, which would make the code better readable and faster.
Otherwise this change looks good.
Arnd
|