From nobody Wed Oct 8 19:17:52 2025 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EB6820D4E7; Wed, 25 Jun 2025 08:37:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750840639; cv=none; b=Vub0wcinjVz0oTXyassEreTLYYxmL35GsBDyWqQ9cZEkT1TRzOvQG2IfFZhSIka99aLZT6Ib65oCVrVklyIMiX8/OyUlZArhHCi7pB7b+5pSVtlcN7M4sPHvtOk9KdzS+KTnOBNlgAV35eM1AVusPDLTraDk8+yulj7qnLhnh9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750840639; c=relaxed/simple; bh=+ymYFCYyzrhnTDccGkxrXRgCQ9ZpY4v1A/adjJaSuu8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Ww4NtSamupKUyCq+7raH2CO/pJoXn5ractWNRt6byDqDQZb4O970yhL5+niq6wcz/l57swTjNxb+nVuFF4cwKX1BHqLCtqgTy3mdqzt8BJG6J2aCgyzuqp9sQDZnzIQxNf5JcfvUtsjM6+sHONLJjHqSYhelLwnr+g7v6Voa8Ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=pankajraghav.com; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pankajraghav.com Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4bRwD84mDJz9tWd; Wed, 25 Jun 2025 10:37:12 +0200 (CEST) From: Pankaj Raghav To: Alexander Viro , Jan Kara , mcgrof@kernel.org, Christian Brauner Cc: kernel@pankajraghav.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, gost.dev@samsung.com, Pankaj Raghav , Matthew Wilcox Subject: [PATCH v3] fs/buffer: remove the min and max limit checks in __getblk_slow() Date: Wed, 25 Jun 2025 10:37:04 +0200 Message-ID: <20250625083704.167993-1-p.raghav@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4bRwD84mDJz9tWd Content-Type: text/plain; charset="utf-8" All filesystems will already check the max and min value of their block size during their initialization. __getblk_slow() is a very low-level function to have these checks. Remove them and only check for logical block size alignment. Suggested-by: Matthew Wilcox Signed-off-by: Pankaj Raghav Reviewed-by: Jan Kara --- Changes since v2: - Removed the max and min checks in __getblk_slow(). fs/buffer.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index a14d281c6a74..a1aa01ebc0ce 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1122,13 +1122,9 @@ __getblk_slow(struct block_device *bdev, sector_t bl= ock, { bool blocking =3D gfpflags_allow_blocking(gfp); =20 - if (unlikely(size & (bdev_logical_block_size(bdev) - 1) || - (size < 512 || size > PAGE_SIZE))) { - printk(KERN_ERR "getblk(): invalid block size %d requested\n", - size); - printk(KERN_ERR "logical block size: %d\n", - bdev_logical_block_size(bdev)); - + if (unlikely(size & (bdev_logical_block_size(bdev) - 1))) { + printk(KERN_ERR "getblk(): block size %d not aligned to logical block si= ze %d\n", + size, bdev_logical_block_size(bdev)); dump_stack(); return NULL; } base-commit: 6ae58121126dcf8efcc2611f216a36a5e50b8ad9 --=20 2.49.0