huge_pte_offset() can return NULL, so we need check it before trying to
take page table lock to avoid a crash.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
do {
next = hugetlb_entry_end(h, addr, end);
pte = huge_pte_offset(walk->mm, addr & hmask);
+ if (!pte)
+ continue;
ptl = huge_pte_lock(h, mm, pte);
/*
* Callers should have their own way to handle swap entries
* in walk->hugetlb_entry().
*/
- if (pte && walk->hugetlb_entry)
+ if (walk->hugetlb_entry)
err = walk->hugetlb_entry(pte, addr, next, walk);
spin_unlock(ptl);
if (err)