lkml.org 
[lkml]   [2013]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [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@arm.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



    \
     
     \ /
      Last update: 2013-12-05 09:41    [W:2.213 / U:0.660 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site