Skip to content

Commit

Permalink
fork: use vma_pages() to simplify the code
Browse files Browse the repository at this point in the history
The current code can be replaced by vma_pages().  So use it to simplify
the code.

[[email protected]: initialise `len' at its definition site]
Signed-off-by: Huang Shijie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
zyzii authored and torvalds committed Jul 31, 2012
1 parent bc452b4 commit b2412b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
}
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned long len;
len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
unsigned long len = vma_pages(mpnt);

if (security_vm_enough_memory_mm(oldmm, len)) /* sic */
goto fail_nomem;
charge = len;
Expand Down

0 comments on commit b2412b7

Please sign in to comment.