From: Nick Piggin Date: Wed, 5 Dec 2007 07:45:25 +0000 (-0800) Subject: mm: fix XIP file writes X-Git-Tag: v2.6.24-rc5~75 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=369b8f5a70402d9fe77006cd0044c8a3fcd08430;p=linux-2.6 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 32132f3cd6..e233fff61b 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);