diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 3b787cb5669907c1035332f00d70826f15c59d85..34f3dfba5e82b3e052a3c2fcb7d8b9870f51efce 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3600,10 +3600,10 @@ static int __init hugepages_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;