lkml.org 
[lkml]   [2013]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] rsxx: returning bytes remaining instead of -EFAULT
copy_to/from_user() returns the number of bytes remaining to be copied.
We should return -EFAULT here instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 6e85e21..102dc60 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -199,9 +199,8 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
if (st)
return st;

- st = copy_to_user(ubuf, buf, cnt);
- if (st)
- return st;
+ if (copy_to_user(ubuf, buf, cnt))
+ return -EFAULT;

info->offset += cnt;

@@ -222,9 +221,8 @@ static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
if (!buf)
return -ENOMEM;

- st = copy_from_user(buf, ubuf, cnt);
- if (st)
- return st;
+ if (copy_from_user(buf, ubuf, cnt))
+ return -EFAULT;

info->f_pos = (u32)*ppos + info->offset;


\
 
 \ /
  Last update: 2013-06-21 09:01    [W:0.036 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site