diff options
author | Huang Shijie <shijie8@gmail.com> | 2012-07-30 17:42:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:20 -0400 |
commit | b2412b7fa7a3816fa8633dc2ff19f1a90aabe423 (patch) | |
tree | 5059c916b993726b3b208859f35c8b59761f2656 /kernel/fork.c | |
parent | bc452b4b65bd589083a7a7ba4f14f85dfc8454fa (diff) |
fork: use vma_pages() to simplify the code
The current code can be replaced by vma_pages(). So use it to simplify
the code.
[akpm@linux-foundation.org: initialise `len' at its definition site]
Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index ff1cad3b7bdc..2c1802948a38 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -391,8 +391,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
391 | } | 391 | } |
392 | charge = 0; | 392 | charge = 0; |
393 | if (mpnt->vm_flags & VM_ACCOUNT) { | 393 | if (mpnt->vm_flags & VM_ACCOUNT) { |
394 | unsigned long len; | 394 | unsigned long len = vma_pages(mpnt); |
395 | len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; | 395 | |
396 | if (security_vm_enough_memory_mm(oldmm, len)) /* sic */ | 396 | if (security_vm_enough_memory_mm(oldmm, len)) /* sic */ |
397 | goto fail_nomem; | 397 | goto fail_nomem; |
398 | charge = len; | 398 | charge = len; |