From c85e9a97c4102ce2e83112da850d838cfab5ab13 Mon Sep 17 00:00:00 2001 From: Wu Fengguang Date: Tue, 2 Feb 2010 13:44:06 -0800 Subject: 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 Cc: Andi Kleen Cc: Benjamin Herrenschmidt Cc: Christoph Lameter Cc: Ingo Molnar Cc: Tejun Heo Cc: Nick Piggin Cc: KAMEZAWA Hiroyuki Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') 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; -- cgit v1.2.3