summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-12-04 23:45:25 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-05 09:21:20 -0800
commit369b8f5a70402d9fe77006cd0044c8a3fcd08430 (patch)
tree7796820d04e7278b37e5dadeda65fe3579dd4ab2
parent4670df831cb479ba57dd0fa0b8a9eb88cc7129be (diff)
downloadop-kernel-dev-369b8f5a70402d9fe77006cd0044c8a3fcd08430.zip
op-kernel-dev-369b8f5a70402d9fe77006cd0044c8a3fcd08430.tar.gz
mm: fix XIP file writes
Writing to XIP files at a non-page-aligned offset results in data corruption because the writes were always sent to the start of the page. Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/filemap_xip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 32132f3..e233fff 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -314,7 +314,7 @@ __xip_file_write(struct file *filp, const char __user *buf,
fault_in_pages_readable(buf, bytes);
kaddr = kmap_atomic(page, KM_USER0);
copied = bytes -
- __copy_from_user_inatomic_nocache(kaddr, buf, bytes);
+ __copy_from_user_inatomic_nocache(kaddr + offset, buf, bytes);
kunmap_atomic(kaddr, KM_USER0);
flush_dcache_page(page);
OpenPOWER on IntegriCloud