From nobody Fri Jan 2 04:58:46 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 52A22CDB465 for ; Mon, 16 Oct 2023 08:43:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbjJPInY (ORCPT ); Mon, 16 Oct 2023 04:43:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbjJPInW (ORCPT ); Mon, 16 Oct 2023 04:43:22 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35E3EB4; Mon, 16 Oct 2023 01:43:21 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33F3DC433C9; Mon, 16 Oct 2023 08:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697445800; bh=vZH1mSBO/jKdSsopvDVjbgMR1QWjfidDel2+WWAxP2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fDtPRRnw/U5qNH9vcEKIZYIHRdx+4vH4lguR7Si8chNVZ1gISfXE9dE+/vgW68nc0 sBV1CiQGY+DzMmj1Cbdc8VjE+6o3TDPV4cKohswHxt+kHXUMvr3IDDbknSIk7mm2cm U035DvJL6nzcXR/TFrbezU+l0aMc0nkgKgyArPwU= 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.15 011/102] lib/test_meminit: fix off-by-one error in test_pages() Date: Mon, 16 Oct 2023 10:40:10 +0200 Message-ID: <20231016083953.990262737@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016083953.689300946@linuxfoundation.org> References: <20231016083953.689300946@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.15-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: 7ad44409cd3b ("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();