[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023101238-greasily-reiterate-aafc@gregkh>
Date: Thu, 12 Oct 2023 10:17:39 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Donnellan <ajd@...ux.ibm.com>,
Alexander Potapenko <glider@...gle.com>,
Xiaoke Wang <xkernel.wang@...mail.com>, stable@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] 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@...ux.ibm.com>
Cc: Alexander Potapenko <glider@...gle.com>
Cc: Xiaoke Wang <xkernel.wang@...mail.com>
Cc: <stable@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.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
Powered by blists - more mailing lists