FROMLIST: lib/test_meminit: fix off-by-one error in test_pages()

In commit efb78fa86e95 ("lib/test_meminit: allocate pages up to order
MAX_ORDER"), the loop for testing pages is set to "<= MAX_ORDER" which
causes crashes in systems when run.  Fix this to "< MAX_ORDER" to fix
the test to work properly.

Fixes: efb78fa86e95 ("lib/test_meminit: allocate pages up to order MAX_ORDER")
Cc: Andrew Donnellan <ajd@linux.ibm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Xiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I213f196c8e32ca18f61c1929d4191a1a368fda06
Link: https://lore.kernel.org/lkml/2023101238-greasily-reiterate-aafc@gregkh/
Fixes: 2a1cf9fe09 ("lib/test_meminit: allocate pages up to order MAX_ORDER")
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2023-10-11 19:34:29 +00:00
parent a8b0203a91
commit 84ae70e787

View File

@ -86,7 +86,7 @@ static int __init test_pages(int *total_failures)
int failures = 0, num_tests = 0;
int i;
for (i = 0; i <= MAX_ORDER; i++)
for (i = 0; i < MAX_ORDER; i++)
num_tests += do_alloc_pages_order(i, &failures);
REPORT_FAILURES_IN_FN();