Message ID | 20240529134509.120826-11-kernel@pankajraghav.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85AB7C25B75 for <linux-mm@archiver.kernel.org>; Wed, 29 May 2024 13:46:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15F846B00B2; Wed, 29 May 2024 09:46:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BFA36B00B3; Wed, 29 May 2024 09:46:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA2376B00B4; Wed, 29 May 2024 09:46:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C96DD6B00B2 for <linux-mm@kvack.org>; Wed, 29 May 2024 09:46:06 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 89AB71A11D3 for <linux-mm@kvack.org>; Wed, 29 May 2024 13:46:06 +0000 (UTC) X-FDA: 82171557132.07.4FF5CF5 Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by imf11.hostedemail.com (Postfix) with ESMTP id D99D84000A for <linux-mm@kvack.org>; Wed, 29 May 2024 13:46:04 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Y7wlIk9q; spf=pass (imf11.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716990365; a=rsa-sha256; cv=none; b=LeHxwsx1gJ3GsacCrjwEQjIjKyaFdxEGQ0bJtj6+jBIcHesdK6J372ODveY9DPH0Gh4VJ5 1p+qZjEB12Wjlz0xmSVTyLXoUE4wpCGhxIzRlKty9+yQGzJlw4Q/wXh/hNURpzyDaQgVh0 bTVSN2pz6JlKj51qNPKJfqyomvl7Ce0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=Y7wlIk9q; spf=pass (imf11.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.172 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=pass (policy=quarantine) header.from=pankajraghav.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716990365; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XXfVdZswQrW+PJKNoyAg9m3URRhUBz2fB+d6rG/p16U=; b=5NShcUMw69h4ivujoie3yLRMhhMGeHfi+/ryhUD5oT00FDTIF+ALU3dMx5foubZn0i/zjk sQBOrOQFGq3S9hki7TBGlEEd5tpXVFvmrE/F/2QzqUQFWOfb3yv0GABvIsp6jJA13qdGoT lrdFsqocwScuK6m67ffR/uQ5lDO8dUc= Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (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-202.mailbox.org (Postfix) with ESMTPS id 4Vq9dP6J7Jz9spb; Wed, 29 May 2024 15:46:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1716990361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XXfVdZswQrW+PJKNoyAg9m3URRhUBz2fB+d6rG/p16U=; b=Y7wlIk9qRzv7K4tdfjamyHbmXFm6kDedt5IbNXR0ASRzYBqQDbTiwUKWH3Nxn48ot+6Zak OfwiYNTnKui3W1HEuPH8HcTistKWS4bwj/E3yNgX5khyuQfsyhvO2ggmx3lY6yTPqRXknl 2oW31GzJVJ6uMqwvtNLujrnLYsvkcPp9YMr53PaMMp/OSKOl4sKnDi1N4nHbKwBz2JgO+P cppHvmzxJrjOOW+xIZhfVRkXwVUO4r9TilmrOj8FhcQmeytlubrh9IZpJB10UBCjnmbVVy XA4RkNV6f4o2hwdpIO9pw/Si9kSgaNhUS1QE8GB8Twgw4F0sHd1EOB49eUZPcQ== From: "Pankaj Raghav (Samsung)" <kernel@pankajraghav.com> To: david@fromorbit.com, chandan.babu@oracle.com, akpm@linux-foundation.org, brauner@kernel.org, willy@infradead.org, djwong@kernel.org Cc: linux-kernel@vger.kernel.org, hare@suse.de, john.g.garry@oracle.com, gost.dev@samsung.com, yang@os.amperecomputing.com, p.raghav@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, mcgrof@kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v6 10/11] xfs: make the calculation generic in xfs_sb_validate_fsb_count() Date: Wed, 29 May 2024 15:45:08 +0200 Message-Id: <20240529134509.120826-11-kernel@pankajraghav.com> In-Reply-To: <20240529134509.120826-1-kernel@pankajraghav.com> References: <20240529134509.120826-1-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D99D84000A X-Stat-Signature: gjmoqt7ie1pwof5ktrxo54oopbhkxswm X-HE-Tag: 1716990364-989166 X-HE-Meta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OU1EejxQlqQY26yykNzt0l6nZ1QdbI69cu5MAKyEIriRALoSrH3WmJNAbzdlSNlojxZwTq/YHqGoFXr9tqkywn0nyJEEirXiN1pOaqu3VFNb12I1rWKudGnBqaQD40y6flmvGDJy+BhfpWKP9Eo7JI92ejzgkZ3PuYyh/iL5bfiudQNQ/W185m7w+pDnNcar0rjihUhcYfFXb9eGX9xdN1P33rG15v1S1Xkp0P0lXkP42pY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
enable bs > ps in XFS
|
expand
|
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 09eef1721ef4..46cb0384143b 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -132,11 +132,19 @@ xfs_sb_validate_fsb_count( xfs_sb_t *sbp, uint64_t nblocks) { + uint64_t max_index; + uint64_t max_bytes; + ASSERT(PAGE_SHIFT >= sbp->sb_blocklog); ASSERT(sbp->sb_blocklog >= BBSHIFT); + if (check_shl_overflow(nblocks, sbp->sb_blocklog, &max_bytes)) + return -EFBIG; + /* Limited by ULONG_MAX of page cache index */ - if (nblocks >> (PAGE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) + max_index = max_bytes >> PAGE_SHIFT; + + if (max_index > ULONG_MAX) return -EFBIG; return 0; }