From nobody Thu Dec 18 00:45:20 2025 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 8E60ECDB482 for ; Thu, 12 Oct 2023 18:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233290AbjJLSBS (ORCPT ); Thu, 12 Oct 2023 14:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442006AbjJLSBP (ORCPT ); Thu, 12 Oct 2023 14:01:15 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 005C9DA; Thu, 12 Oct 2023 11:01:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9FF0C433C9; Thu, 12 Oct 2023 18:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697133673; bh=QFecizGKt2XzydnEGdzznTEe7ougz7DAeR8j0nzXygc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMuRQoiK6bHpZsT8I6pivOrbIDkfr9gWP+8JAK3rIodq8z9/Heo6IiNsWLp9HviUb JMYnED3NQGeDdTnzmnlOoUfZtqC1iql2IIEmRmc81GEB2opteuiSteNxv12YmQK5Ik RBnqKOop9/SeZiW/eNpQyHtLAoeULgKiK7mJEJpw= 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 6.1 6/6] lib/test_meminit: fix off-by-one error in test_pages() Date: Thu, 12 Oct 2023 20:00:48 +0200 Message-ID: <20231012180030.279678796@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231012180030.112560642@linuxfoundation.org> References: <20231012180030.112560642@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" 6.1-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: 421855d0d24d ("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 @@ -93,7 +93,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();