summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorWu Fengguang <fengguang.wu@intel.com>2010-02-02 13:44:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2010-02-02 18:11:22 -0800
commitc85e9a97c4102ce2e83112da850d838cfab5ab13 (patch)
tree7c3216be064c82eb2c7793d3d078d45a3bfc6f4c /drivers/char
parent325fda71d0badc1073dc59f12a948f24ff05796a (diff)
downloadlinux-c85e9a97c4102ce2e83112da850d838cfab5ab13.tar.gz
linux-c85e9a97c4102ce2e83112da850d838cfab5ab13.tar.bz2
linux-c85e9a97c4102ce2e83112da850d838cfab5ab13.zip
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: Wu 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/mem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 1fd4b110d815..48788db4e280 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -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;