diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f7e41390f3d8ba06e9f247099bbee951c7b3edb3..68cec97bbd066f11203728b7ee585c5eeff8ef41 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3151,10 +3151,10 @@ static int __init hugetlb_nrpages_setup(char *s) pr_warn("HugeTLB: architecture can't support node specific alloc, ignoring!\n"); return 0; } + if (tmp >= nr_online_nodes) + goto invalid; node = tmp; p += count + 1; - if (node < 0 || node >= nr_online_nodes) - goto invalid; /* Parse hugepages */ if (sscanf(p, "%lu%n", &tmp, &count) != 1) goto invalid;