lkml.org 
[lkml]   [2010]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 02/43] ptrace: cleanup ptrace_request()
Date
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


\
 
 \ /
  Last update: 2010-08-27 16:25    [W:0.122 / U:1.368 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site