devmem: fix kmem write bug on memory holes
authorWu Fengguang <[email protected]>
Tue, 2 Feb 2010 21:44:06 +0000 (13:44 -0800)
committerLinus Torvalds <[email protected]>
Wed, 3 Feb 2010 02:11:22 +0000 (18:11 -0800)
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]>
drivers/char/mem.c

index 1fd4b110d81550114612b120d9cb04d056464dac..48788db4e280f89e289a4d9f2e31b8519244b82c 100644 (file)
@@ -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;