mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 04:20:23 +09:00
FROMLIST: lib/test_meminit: fix off-by-one error in test_pages()
In commitefb78fa86e("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. 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:7ad44409cd("lib/test_meminit: allocate pages up to order MAX_ORDER") Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user