Commit c85e9a97 authored by Wu Fengguang's avatar Wu Fengguang Committed by Linus Torvalds

devmem: fix kmem write bug on memory holes

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: default avatarWu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Tejun Heo <tj@kernel.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 325fda71
...@@ -555,7 +555,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, ...@@ -555,7 +555,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
err = -EFAULT; err = -EFAULT;
break; break;
} }
sz = vwrite(kbuf, (char *)p, sz); vwrite(kbuf, (char *)p, sz);
count -= sz; count -= sz;
buf += sz; buf += sz;
virtr += sz; virtr += 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