From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Donnellan <ajd@linux.ibm.com>,
Alexander Potapenko <glider@google.com>,
Xiaoke Wang <xkernel.wang@foxmail.com>,
stable@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] lib/test_meminit: fix off-by-one error in test_pages()
Date: Thu, 12 Oct 2023 10:17:39 +0200 [thread overview]
Message-ID: <2023101238-greasily-reiterate-aafc@gregkh> (raw)
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
next reply other threads:[~2023-10-12 8:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 8:17 Greg Kroah-Hartman [this message]
2023-10-12 8:40 ` [PATCH] lib/test_meminit: fix off-by-one error in test_pages() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023101238-greasily-reiterate-aafc@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=ajd@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=xkernel.wang@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.