[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201008271623.01761.arnd@arndb.de>
Date: Fri, 27 Aug 2010 16:23:01 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Namhyung Kim <namhyung@...il.com>
Cc: Roland McGrath <roland@...hat.com>,
Oleg Nesterov <oleg@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 02/43] ptrace: cleanup ptrace_request()
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists