Messages in this thread Patch in this message | | | Date | Wed, 16 Sep 2009 11:00:10 +0800 | From | Wu Fengguang <> | Subject | [PATCH 1/4] 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.
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> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com> --- drivers/char/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-mm.orig/drivers/char/mem.c 2009-09-16 10:41:10.000000000 +0800 +++ linux-mm/drivers/char/mem.c 2009-09-16 10:48:16.000000000 +0800 @@ -548,7 +548,7 @@ static ssize_t write_kmem(struct file * free_page((unsigned long)kbuf); return -EFAULT; } - sz = vwrite(kbuf, (char *)p, sz); + vwrite(kbuf, (char *)p, sz); count -= sz; buf += sz; virtr += sz; --
| |