Commit ea2758da authored by Wu Fengguang's avatar Wu Fengguang Committed by james toy

No behaviour change.

Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f28ce532
......@@ -131,6 +131,7 @@ static ssize_t read_mem(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
unsigned long ret;
ssize_t read, sz;
char *ptr;
......@@ -169,12 +170,10 @@ static ssize_t read_mem(struct file * file, char __user * buf,
if (!ptr)
return -EFAULT;
if (copy_to_user(buf, ptr, sz)) {
unxlate_dev_mem_ptr(p, ptr);
return -EFAULT;
}
ret = copy_to_user(buf, ptr, sz);
unxlate_dev_mem_ptr(p, ptr);
if (ret)
return -EFAULT;
buf += sz;
p += sz;
......@@ -232,16 +231,14 @@ static ssize_t write_mem(struct file * file, const char __user * buf,
}
copied = copy_from_user(ptr, buf, sz);
unxlate_dev_mem_ptr(p, ptr);
if (copied) {
written += sz - copied;
unxlate_dev_mem_ptr(p, ptr);
if (written)
break;
return -EFAULT;
}
unxlate_dev_mem_ptr(p, ptr);
buf += sz;
p += sz;
count -= sz;
......
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