lkml.org 
[lkml]   [2015]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv2 6/9] staging: vme_user: return -EFAULT on __copy_*_user errors
On Tue, Jun 23, 2015 at 07:03:36PM +0300, Dmitry Kalinkin wrote:
> Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
> ---
> drivers/staging/vme/devices/vme_user.c | 47 ++++++++--------------------------
> 1 file changed, 11 insertions(+), 36 deletions(-)
>
<snip>
> @@ -178,38 +167,24 @@ static ssize_t buffer_to_user(unsigned int minor, char __user *buf,
> size_t count, loff_t *ppos)
> {
> void *image_ptr;
> - ssize_t retval;
>
> image_ptr = image[minor].kern_buf + *ppos;
> + if (__copy_to_user(buf, image_ptr, (unsigned long)count))
> + return -EFAULT;
>
> - retval = __copy_to_user(buf, image_ptr, (unsigned long)count);
> - if (retval != 0) {
> - retval = (count - retval);
> - pr_warn("Partial copy to userspace\n");
> - } else
> - retval = count;
> -
> - /* Return number of bytes successfully read */
> - return retval;
> + return count;
will it not affect the userspace code?
previously number of bytes successfully read was returned, now incase of
partial read -EFAULT is being returned.

regards
sudip


\
 
 \ /
  Last update: 2015-06-25 13:41    [W:0.141 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site