aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/hugetlbpage.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/hugetlbpage.c')
-rw-r--r--arch/powerpc/mm/hugetlbpage.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 89c836d54809..1bb20d841080 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -744,7 +744,8 @@ static int htlb_check_hinted_area(unsigned long addr, unsigned long len)
744 struct vm_area_struct *vma; 744 struct vm_area_struct *vma;
745 745
746 vma = find_vma(current->mm, addr); 746 vma = find_vma(current->mm, addr);
747 if (!vma || ((addr + len) <= vma->vm_start)) 747 if (TASK_SIZE - len >= addr &&
748 (!vma || ((addr + len) <= vma->vm_start)))
748 return 0; 749 return 0;
749 750
750 return -ENOMEM; 751 return -ENOMEM;
@@ -815,6 +816,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
815 return -EINVAL; 816 return -EINVAL;
816 if (len & ~HPAGE_MASK) 817 if (len & ~HPAGE_MASK)
817 return -EINVAL; 818 return -EINVAL;
819 if (len > TASK_SIZE)
820 return -ENOMEM;
818 821
819 if (!cpu_has_feature(CPU_FTR_16M_PAGE)) 822 if (!cpu_has_feature(CPU_FTR_16M_PAGE))
820 return -EINVAL; 823 return -EINVAL;
@@ -823,9 +826,6 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
823 BUG_ON((addr + len) < addr); 826 BUG_ON((addr + len) < addr);
824 827
825 if (test_thread_flag(TIF_32BIT)) { 828 if (test_thread_flag(TIF_32BIT)) {
826 /* Paranoia, caller should have dealt with this */
827 BUG_ON((addr + len) > 0x100000000UL);
828
829 curareas = current->mm->context.low_htlb_areas; 829 curareas = current->mm->context.low_htlb_areas;
830 830
831 /* First see if we can use the hint address */ 831 /* First see if we can use the hint address */