From: Nick Piggin Date: Wed, 5 Dec 2007 07:45:25 +0000 (-0800) Subject: mm: fix XIP file writes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=369b8f5a70402d9fe77006cd0044c8a3fcd08430;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: Christian Borntraeger Acked-by: Carsten Otte Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index 32132f3cd641..e233fff61b4b 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);