intel-hid: allocate correct amount of memory for private struct
[cascardo/linux.git] / mm / madvise.c
index 4e94546..f56825b 100644 (file)
@@ -271,8 +271,13 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr,
        pte_t *orig_pte, *pte, ptent;
        struct page *page;
        int nr_swap = 0;
+       unsigned long next;
+
+       next = pmd_addr_end(addr, end);
+       if (pmd_trans_huge(*pmd))
+               if (madvise_free_huge_pmd(tlb, vma, pmd, addr, next))
+                       goto next;
 
-       split_huge_pmd(vma, pmd, addr);
        if (pmd_trans_unstable(pmd))
                return 0;
 
@@ -383,6 +388,7 @@ out:
        arch_leave_lazy_mmu_mode();
        pte_unmap_unlock(orig_pte, ptl);
        cond_resched();
+next:
        return 0;
 }