cow_user_page: fix page alignment

High Dickins points out that the user virtual address passed to the page
fault handler isn't necessarily page-aligned.

Also, add a comment on why the copy could fail for the user address case.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>

+9 -2
+9 -2
mm/memory.c
··· 1394 */ 1395 if (unlikely(!src)) { 1396 void *kaddr = kmap_atomic(dst, KM_USER0); 1397 - unsigned long left = __copy_from_user_inatomic(kaddr, (void __user *)va, PAGE_SIZE); 1398 - if (left) 1399 memset(kaddr, 0, PAGE_SIZE); 1400 kunmap_atomic(kaddr, KM_USER0); 1401 return;
··· 1394 */ 1395 if (unlikely(!src)) { 1396 void *kaddr = kmap_atomic(dst, KM_USER0); 1397 + void __user *uaddr = (void __user *)(va & PAGE_MASK); 1398 + 1399 + /* 1400 + * This really shouldn't fail, because the page is there 1401 + * in the page tables. But it might just be unreadable, 1402 + * in which case we just give up and fill the result with 1403 + * zeroes. 1404 + */ 1405 + if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) 1406 memset(kaddr, 0, PAGE_SIZE); 1407 kunmap_atomic(kaddr, KM_USER0); 1408 return;