Skip to content

Commit

Permalink
devmem: fix kmem write bug on memory holes
Browse files Browse the repository at this point in the history
write_kmem() used to assume vwrite() always return the full buffer length.
However now vwrite() could return 0 to indicate memory hole.  This
creates a bug that "buf" is not advanced accordingly.

Fix it to simply ignore the return value, hence the memory hole.

Signed-off-by: Wu Fengguang <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wu Fengguang authored and torvalds committed Feb 3, 2010
1 parent 325fda7 commit c85e9a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
err = -EFAULT;
break;
}
sz = vwrite(kbuf, (char *)p, sz);
vwrite(kbuf, (char *)p, sz);
count -= sz;
buf += sz;
virtr += sz;
Expand Down

0 comments on commit c85e9a9

Please sign in to comment.