]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/mm/hugetlbpage.c
powerpc: Check for valid hugepage size in hugetlb_get_unmapped_area
[linux-2.6-omap-h63xx.git] / arch / powerpc / mm / hugetlbpage.c
index a117024ab8cdb68af98c8bfc13f822695dc4c2bf..f0c3b88d50fa5a5f98847bd1914be1881885af9d 100644 (file)
@@ -507,6 +507,9 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
 {
        struct hstate *hstate = hstate_file(file);
        int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
+
+       if (!mmu_huge_psizes[mmu_psize])
+               return -EINVAL;
        return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0);
 }
 
@@ -677,7 +680,7 @@ repeat:
        return err;
 }
 
-void set_huge_psize(int psize)
+static void __init set_huge_psize(int psize)
 {
        /* Check that it is a page size supported by the hardware and
         * that it fits within pagetable limits. */