Commit 8deb34fe authored by Patrick Mochel's avatar Patrick Mochel

sysfs: return -EFAULT if copy_{to,from}_user() doesn't copy all bytes.

...instead of returning the error value (which is number of bytes remaining).
parent bcd998aa
...@@ -247,7 +247,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf, ...@@ -247,7 +247,7 @@ static int flush_read_buffer(struct sysfs_buffer * buffer, char * buf,
error = copy_to_user(buf,buffer->page + *ppos,count); error = copy_to_user(buf,buffer->page + *ppos,count);
if (!error) if (!error)
*ppos += count; *ppos += count;
return error ? error : count; return error ? -EFAULT : count;
} }
/** /**
...@@ -308,7 +308,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count) ...@@ -308,7 +308,7 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char * buf, size_t count)
if (count >= PAGE_SIZE) if (count >= PAGE_SIZE)
count = PAGE_SIZE - 1; count = PAGE_SIZE - 1;
error = copy_from_user(buffer->page,buf,count); error = copy_from_user(buffer->page,buf,count);
return error ? error : count; return error ? -EFAULT : count;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment