Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176235
b: refs/heads/master
c: fa29e97
h: refs/heads/master
i:
  176233: ad68871
  176231: 38cb07b
v: v3
  • Loading branch information
Wu Fengguang authored and Linus Torvalds committed Dec 15, 2009
1 parent f1d0492 commit 86ea9a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f222318e9c3a315723e3524fb9d6566b2430db44
refs/heads/master: fa29e97bb8c70fd7f564acbed3422403cee10ab7
14 changes: 6 additions & 8 deletions trunk/drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ static ssize_t read_mem(struct file * file, char __user * buf,
#endif

while (count > 0) {
unsigned long remaining;

sz = size_inside_page(p, count);

if (!range_is_allowed(p >> PAGE_SHIFT, count))
Expand All @@ -168,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;
}

remaining = copy_to_user(buf, ptr, sz);
unxlate_dev_mem_ptr(p, ptr);
if (remaining)
return -EFAULT;

buf += sz;
p += sz;
Expand Down Expand Up @@ -231,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;
Expand Down

0 comments on commit 86ea9a2

Please sign in to comment.