Skip to content

Commit

Permalink
FROMLIST: lib/test_meminit: fix off-by-one error in test_pages()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Cc: Xiaoke Wang <[email protected]>
Cc: <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Change-Id: I213f196c8e32ca18f61c1929d4191a1a368fda06
Link: https://lore.kernel.org/lkml/2023101238-greasily-reiterate-aafc@gregkh/
Fixes: cbfffe51221b ("lib/test_meminit: allocate pages up to order MAX_ORDER")
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh authored and rifsxd committed Jan 4, 2025
1 parent a083453 commit 4d2fd93
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/test_meminit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4d2fd93

Please sign in to comment.