[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131205083637.GV28413@mwanda>
Date: Thu, 5 Dec 2013 11:36:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Serban Constantinescu <serban.constantinescu@....com>
Cc: gregkh@...uxfoundation.org, arve@...roid.com,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
john.stultz@...aro.org, ccross@...roid.com, Dave.Butcher@....com,
irogers@...gle.com, romlem@...roid.com
Subject: Re: [PATCH v1 2/9] staging: android: binder: Add
binder_copy_to_user()
On Wed, Dec 04, 2013 at 06:09:34PM +0000, Serban Constantinescu wrote:
> This patch adds binder_copy_to_user() to be used for copying binder
> commands to user address space. This way we can abstract away the
> copy_to_user() calls and add separate handling for the compat layer.
>
> Signed-off-by: Serban Constantinescu <serban.constantinescu@....com>
> ---
> drivers/staging/android/binder.c | 39 ++++++++++++++++++++------------------
> 1 file changed, 21 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
> index 233889c..6fbb340 100644
> --- a/drivers/staging/android/binder.c
> +++ b/drivers/staging/android/binder.c
> @@ -2117,6 +2117,18 @@ static int binder_has_thread_work(struct binder_thread *thread)
> (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN);
> }
>
> +static int binder_copy_to_user(uint32_t cmd, void *parcel,
> + void __user **ptr, size_t size)
> +{
Bike shedding: Put the **ptr as the first argument.
binder_copy_to_user(dest, cmd, src, size);
> + if (put_user(cmd, (uint32_t __user *)*ptr))
> + return -EFAULT;
> + *ptr += sizeof(uint32_t);
> + if (copy_to_user(*ptr, parcel, size))
> + return -EFAULT;
> + *ptr += size;
> + return 0;
> +}
regards,
dan carpenter
--
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