public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/test_meminit: fix off-by-one error in test_pages()
@ 2023-10-12  8:17 Greg Kroah-Hartman
  2023-10-12  8:40 ` Alexander Potapenko
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-12  8:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Andrew Donnellan, Alexander Potapenko,
	Xiaoke Wang, stable, Andrew Morton

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>
---
 lib/test_meminit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/test_meminit.c b/lib/test_meminit.c
index 0ae35223d773..85d8dd8e01dc 100644
--- a/lib/test_meminit.c
+++ b/lib/test_meminit.c
@@ -93,7 +93,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();
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-12 11:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-12  8:17 [PATCH] lib/test_meminit: fix off-by-one error in test_pages() Greg Kroah-Hartman
2023-10-12  8:40 ` Alexander Potapenko
2023-10-12 10:26   ` Greg Kroah-Hartman
2023-10-12 10:37     ` Greg Kroah-Hartman
2023-10-12 11:14       ` Alexander Potapenko
2023-10-12 11:24         ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox