From patchwork Mon Oct 14 10:58:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834848 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE5AAD1624A for ; Mon, 14 Oct 2024 11:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zTmw5JCDPKyesvf4SHt2c/Iv1pPV+8Di4FJdKvNluCo=; b=C/V5Diub2FERF7KROrKs6LBEsO nWr9+zSsZrbckn2p79mzTlE2wpwEKie1sDVkjPkj9pYOxdOn1C0LU4gW7qCqOJ52PZOoOctRgy1Of 7yiU2xEqeLx+p9SyULNcYOI5yrgp/kuTHV81dRuo85UVtn8XrUlq0df/k/e5YIUxeWBmDmtaE10tD eCfsCjaBg7X5A8lOTbxsOe9XIiNXHJr86Axj+TwRcTC7icvzhI9S5ZtMQZewQYmozvsYnd8kNVZNt pNfeJibYW7up+bltIHYzoxb0rlIQReOLfo+6dA8xRf23C8z72UuwM4i8zBw3K0Jz47Ynl/QsEs7/Z DOWXA40g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Jc6-00000004zUp-04Na; Mon, 14 Oct 2024 11:51:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0IoP-00000004nr0-0hX8 for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2024 11:00:30 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 61C921688; Mon, 14 Oct 2024 04:00:58 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0597C3F51B; Mon, 14 Oct 2024 04:00:25 -0700 (PDT) From: Ryan Roberts To: "David S. Miller" , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Herbert Xu , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 20/57] crypto: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:27 +0100 Message-ID: <20241014105912.3207374-20-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_040029_271127_475FF057 X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To prepare for supporting boot-time page size selection, refactor code to remove assumptions about PAGE_SIZE being compile-time constant. Code intended to be equivalent when compile-time page size is active. Updated BUILD_BUG_ON() to test against limit. Signed-off-by: Ryan Roberts Acked-by: Herbert Xu --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ crypto/lskcipher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/lskcipher.c b/crypto/lskcipher.c index cdb4897c63e6f..2b84cefba7cd1 100644 --- a/crypto/lskcipher.c +++ b/crypto/lskcipher.c @@ -79,8 +79,8 @@ static int crypto_lskcipher_crypt_unaligned( u8 *tiv; u8 *p; - BUILD_BUG_ON(MAX_CIPHER_BLOCKSIZE > PAGE_SIZE || - MAX_CIPHER_ALIGNMASK >= PAGE_SIZE); + BUILD_BUG_ON(MAX_CIPHER_BLOCKSIZE > PAGE_SIZE_MIN || + MAX_CIPHER_ALIGNMASK >= PAGE_SIZE_MIN); tiv = kmalloc(PAGE_SIZE, GFP_ATOMIC); if (!tiv)