From: Vasiliy Kulikov Date: Tue, 26 Oct 2010 21:21:32 +0000 (-0700) Subject: mm/mempolicy.c: check return code of check_range X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0def08e3acc2c9c934e4671487029aed52202d42;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm/mempolicy.c: check return code of check_range Function check_range may return ERR_PTR(...). Check for it. Signed-off-by: Vasiliy Kulikov Acked-by: David Rientjes Reviewed-by: Christoph Lameter Reviewed-by: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 21243b2b7b07..81a127643aea 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -924,12 +924,15 @@ static int migrate_to_node(struct mm_struct *mm, int source, int dest, nodemask_t nmask; LIST_HEAD(pagelist); int err = 0; + struct vm_area_struct *vma; nodes_clear(nmask); node_set(source, nmask); - check_range(mm, mm->mmap->vm_start, mm->task_size, &nmask, + vma = check_range(mm, mm->mmap->vm_start, mm->task_size, &nmask, flags | MPOL_MF_DISCONTIG_OK, &pagelist); + if (IS_ERR(vma)) + return PTR_ERR(vma); if (!list_empty(&pagelist)) { err = migrate_pages(&pagelist, new_node_page, dest, 0);