aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 07fc94758799..0feeef860a8f 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -336,14 +336,13 @@ vma_address(struct page *page, struct vm_area_struct *vma)
336 336
337/* 337/*
338 * At what user virtual address is page expected in vma? 338 * At what user virtual address is page expected in vma?
339 * checking that the page matches the vma. 339 * Caller should check the page is actually part of the vma.
340 */ 340 */
341unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) 341unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma)
342{ 342{
343 if (PageAnon(page)) { 343 if (PageAnon(page))
344 if (vma->anon_vma != page_anon_vma(page)) 344 ;
345 return -EFAULT; 345 else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) {
346 } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) {
347 if (!vma->vm_file || 346 if (!vma->vm_file ||
348 vma->vm_file->f_mapping != page->mapping) 347 vma->vm_file->f_mapping != page->mapping)
349 return -EFAULT; 348 return -EFAULT;