From nobody Thu Jan 1 12:36:42 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E729C25B41 for ; Mon, 23 Oct 2023 11:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234326AbjJWLnH (ORCPT ); Mon, 23 Oct 2023 07:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234426AbjJWLmz (ORCPT ); Mon, 23 Oct 2023 07:42:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A87B1988; Mon, 23 Oct 2023 04:42:47 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDD08C433CC; Mon, 23 Oct 2023 11:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698061367; bh=IVU3t0iDHy73gQKGWr58nGN8gjjzyZ0qQW4gTPxs1TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qRsxBcAHTgPlC0WnbTt5lDRHuok4TIcsDHwGh4r/jA4xKmKEQ64Zi7NKhY6yBeKZx JblXZSw3KodhUOCJ0EUJpmP+FtnIwTt8EFQnl+sLoWMl2kjcVmGx6AfcFX7rnItBNK SZduZrvsoPuMegTSygMeXwGIdu/DVWshTS+OZNss= From: Greg Kroah-Hartman To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Andrew Donnellan , Alexander Potapenko , Xiaoke Wang , Andrew Morton Subject: [PATCH 5.10 006/202] lib/test_meminit: fix off-by-one error in test_pages() Date: Mon, 23 Oct 2023 12:55:13 +0200 Message-ID: <20231023104826.776616509@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231023104826.569169691@linuxfoundation.org> References: <20231023104826.569169691@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman 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 "<=3D 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_ORDE= R") Cc: Andrew Donnellan Cc: Alexander Potapenko Cc: Xiaoke Wang Cc: Cc: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- lib/test_meminit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/test_meminit.c +++ b/lib/test_meminit.c @@ -86,7 +86,7 @@ static int __init test_pages(int *total_ int failures =3D 0, num_tests =3D 0; int i; =20 - for (i =3D 0; i <=3D MAX_ORDER; i++) + for (i =3D 0; i < MAX_ORDER; i++) num_tests +=3D do_alloc_pages_order(i, &failures); =20 REPORT_FAILURES_IN_FN();