lkml.org 
[lkml]   [2010]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3/6] ip2: return -EFAULT on copy_to_user errors
    Date
    From: Dan Carpenter <error27@gmail.com>

    copy_to_user() returns the number of bytes remaining but we want to return
    a negative error code on errors.

    Signed-off-by: Dan Carpenter <error27@gmail.com>
    Cc: "Michael H. Warfield" <mhw@wittsend.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    drivers/char/ip2/ip2main.c | 2 ++
    1 files changed, 2 insertions(+), 0 deletions(-)

    diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
    index 8fa041e..d4b71e8 100644
    --- a/drivers/char/ip2/ip2main.c
    +++ b/drivers/char/ip2/ip2main.c
    @@ -2930,6 +2930,8 @@ ip2_ipl_ioctl (struct file *pFile, UINT cmd, ULONG arg )
    if ( pCh )
    {
    rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
    + if (rc)
    + rc = -EFAULT;
    } else {
    rc = -ENODEV;
    }
    --
    1.7.2


    \
     
     \ /
      Last update: 2010-08-24 06:27    [W:0.089 / U:0.052 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site