diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-12 10:17:39 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-25 11:54:13 +0200 |
| commit | cb4a8146e3a9bff52d987941135f7703fda9d0e9 (patch) | |
| tree | 051b03dff7a4c88a4f4d462b2582dae0412f10e1 /lib | |
| parent | 06068e7f3ff8c0beddd30b978743d271479ecbb5 (diff) | |
| download | linux-cb4a8146e3a9bff52d987941135f7703fda9d0e9.tar.gz linux-cb4a8146e3a9bff52d987941135f7703fda9d0e9.tar.bz2 linux-cb4a8146e3a9bff52d987941135f7703fda9d0e9.zip | |
lib/test_meminit: fix off-by-one error in test_pages()
commit efb78fa86e95 ("lib/test_meminit: allocate pages up to order
MAX_ORDER") works great in kernels 6.4 and newer thanks to commit
23baf831a32c ("mm, treewide: redefine MAX_ORDER sanely"), but for older
kernels, the loop is off by one, which causes crashes when the test
runs.
Fix this up by changing "<= MAX_ORDER" "< MAX_ORDER" to allow the test
to work properly for older kernel branches.
Fixes: 2a1cf9fe09d9 ("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>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/test_meminit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_meminit.c b/lib/test_meminit.c index 75638404ed57..0f1a3bd09b7b 100644 --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -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(); |
