From patchwork Mon Oct 14 10:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834864 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 E836BD1624F for ; Mon, 14 Oct 2024 12:10:28 +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=X8VEpkJ0okgdpGRrvWSbQdQmtub8XCGEswPb3bOfN9k=; b=Tx+Db6NmLop9qI/M4DIUsebUZ/ 8qgvGM72y0DH/BzBw7z2CkVelIOxu0Lzztjtp29JV+WjzXZGu5P4Kx4wJGjB4qg5uOO/gDu5RSno7 xkuwHU7sovXDR8iowT0Dsj+6vwo/+y+kIz8n3X9yIjpPJZ8eLPN5VuzSkxNLpgriNoqI040McL+YN 2Tt/Gyt+LmlpEmmeakV73XfXww5c/O52+CzNGtITAl0CsXHWXySJTfi+9/eIM3SbmZ/AbFW7IQluL Frv0I7Sz+kvNhSa0wB0skrZy+WFvMunNEppJrfZz/fL7LBJ80NKo/ebu37ExTMne1Xy/E1JBzJWTx 8yZX1Xpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Jtx-000000052Bk-0Lqz; Mon, 14 Oct 2024 12:10:17 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Ip5-00000004oCo-25py for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2024 11:01:12 +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 B62B016F8; Mon, 14 Oct 2024 04:01:40 -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 78EA33F51B; Mon, 14 Oct 2024 04:01:08 -0700 (PDT) From: Ryan Roberts To: "Jason A. Donenfeld" , "Theodore Ts'o" , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 33/57] random: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:40 +0100 Message-ID: <20241014105912.3207374-33-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_040111_602127_0343693B X-CRM114-Status: GOOD ( 10.88 ) 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. Update BUILD_BUG_ON()s to test against page size limits. Signed-off-by: Ryan Roberts --- ***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/ drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 87fe61295ea1f..49d6c4ef16df4 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -466,7 +466,7 @@ static ssize_t get_random_bytes_user(struct iov_iter *iter) if (!iov_iter_count(iter) || copied != sizeof(block)) break; - BUILD_BUG_ON(PAGE_SIZE % sizeof(block) != 0); + BUILD_BUG_ON(PAGE_SIZE_MIN % sizeof(block) != 0); if (ret % PAGE_SIZE == 0) { if (signal_pending(current)) break; @@ -1428,7 +1428,7 @@ static ssize_t write_pool_user(struct iov_iter *iter) if (!iov_iter_count(iter) || copied != sizeof(block)) break; - BUILD_BUG_ON(PAGE_SIZE % sizeof(block) != 0); + BUILD_BUG_ON(PAGE_SIZE_MIN % sizeof(block) != 0); if (ret % PAGE_SIZE == 0) { if (signal_pending(current)) break;