From patchwork Wed Jan 7 23:44:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1338 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829643; bh=2qjE8xeexSAi5R6G71g1yZlxTBDm+B+6bZS4pC2l8vg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=BX8ZadqwWGHS/QTj5AZF0pNkqX1XVWuqUxAW6ffP4h3XQvm/sPFVP0/Xw/0MSUeHJ HSzilm7xgfH5+U2wxnfzI/ndY5k1buO+m1XWhC2ilKIWVdreoiEtHEhT+zHDkF3muT BB6qEqlZn2zwjMX63hKF1NVJkIu8uJjYxWuxImCifi1WwcsaVaFQJTchPfsRV41t+6 vcBeqQWgDW5plXSdsKlJF4PP5V7uT7vlR416tO+u4HQ3ofjrjE42a4k65l4JBRjE6e wYjUE/lWKhANokz0R6wJacuHEhmOn2k1+Rlc9uDL9o4H37gnANr8+wBKTxSYFACZlC TiF15dNqKb8Fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 893BE691A2 for ; Wed, 7 Jan 2026 16:47:23 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9BWRvFKAzqIU for ; Wed, 7 Jan 2026 16:47:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829643; bh=2qjE8xeexSAi5R6G71g1yZlxTBDm+B+6bZS4pC2l8vg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=BX8ZadqwWGHS/QTj5AZF0pNkqX1XVWuqUxAW6ffP4h3XQvm/sPFVP0/Xw/0MSUeHJ HSzilm7xgfH5+U2wxnfzI/ndY5k1buO+m1XWhC2ilKIWVdreoiEtHEhT+zHDkF3muT BB6qEqlZn2zwjMX63hKF1NVJkIu8uJjYxWuxImCifi1WwcsaVaFQJTchPfsRV41t+6 vcBeqQWgDW5plXSdsKlJF4PP5V7uT7vlR416tO+u4HQ3ofjrjE42a4k65l4JBRjE6e wYjUE/lWKhANokz0R6wJacuHEhmOn2k1+Rlc9uDL9o4H37gnANr8+wBKTxSYFACZlC TiF15dNqKb8Fg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6AF4D691A6 for ; Wed, 7 Jan 2026 16:47:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829641; bh=nR4g+8Y2EWiEw8uzrDL04Q5InOK6KFvAoi2HBQg8lw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IP7py8BNSb9eB/RzGAY6UEaRGloxtLTRSIGKN+NeHaBVtJA+p0ZK9vhHQoVMTf9rL 7xbwhkFnENz37QU8UdtbbIkRMbi6qoqoHwbFODTP5LNJMO3Q2Yrubngm4sbi1ZItNY ncadmLnhJOW2ib9D23uXXuGjOrjkgD5EfEg3W+TQ7VBwLWOjMGhjh5IxP+55Hm//8e ysz2VXNCDue5CIm/iJU05LkDoEqAkcKvAhPIsKlP2ADLfY0L51+t3HgFCQRzsJHZeX HGUfXYtOUyPC4mVM4SyILrQJ5Wr49oI63JDiIyLhTziPz/lV+oEsX0PDYfjR/0371Z a91Pgd6JSFigQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B1B1D691A2; Wed, 7 Jan 2026 16:47:21 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id OPpSma-9xhBY; Wed, 7 Jan 2026 16:47:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767829637; bh=aZRTfk5MkSHVDL7AXIVRswPnGhrb9MTb9G19jFur2UU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WST7El4+okFEq4F7PAcgrVX+ipHfP1eFA9MHY2bbHHIaeizcJVL5ICMubCvbULfWc EbBXaICDMCtyWxWv89FQUj/BDUHNhhv+wGERqWhF7gsGkDR3dnzMmqtfuv3Edr/Enu DJE2yVjMHJP0BjhnwKcs7zzEOv/O7JKFsmpNEwIM2YkPtkhHlaMdEe6YKEKu8+/OnB KuJk2SCg1Pux3NYVLGnB4wwvcU/dT4GsVnP5XJ1sVAftO3Bb4mO2Rcgg50EbhhNZ/6 sMeZ6oQY32aggzY/KqLsZ1ts9mbDGbPFQuED68nzXSYyGbTsj8r+XpYbcIccnCKsSY QS0TIb7WqtsBQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F17DF69187; Wed, 7 Jan 2026 16:47:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 7 Jan 2026 16:44:16 -0700 Message-ID: <20260107234426.3508161-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260107234426.3508161-1-sjg@u-boot.org> References: <20260107234426.3508161-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: AKUY3MQJ2KEDMRAUA5A72I6OO2JMQLKT X-Message-ID-Hash: AKUY3MQJ2KEDMRAUA5A72I6OO2JMQLKT X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 6/9] fs: ext4l: Use EXT4_MAX_ORPHAN_FILE_BLOCKS in orphan.c List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add the EXT4_MAX_ORPHAN_FILE_BLOCKS constant (512) and use it in the orphan file size check, matching the Linux kernel implementation. The previous hardcoded value of (8 << 20) assumed 16KB blocks to get 512 blocks, but the proper calculation uses the actual block size from the inode. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/orphan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4l/orphan.c b/fs/ext4l/orphan.c index 65d0d177c5d..0f5dcca1d96 100644 --- a/fs/ext4l/orphan.c +++ b/fs/ext4l/orphan.c @@ -7,6 +7,8 @@ #include "ext4.h" #include "ext4_jbd2.h" +#define EXT4_MAX_ORPHAN_FILE_BLOCKS 512 + static int ext4_orphan_file_add(handle_t *handle, struct inode *inode) { int i, j, start; @@ -596,7 +598,7 @@ int ext4_init_orphan_info(struct super_block *sb) * consuming absurd amounts of memory when pinning blocks of orphan * file in memory. */ - if (inode->i_size > 8 << 20) { + if (inode->i_size > (EXT4_MAX_ORPHAN_FILE_BLOCKS << inode->i_blkbits)) { ext4_msg(sb, KERN_ERR, "orphan file too big: %llu", (unsigned long long)inode->i_size); ret = -EFSCORRUPTED;