mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
	Paulo Alcantara <pc@manguebit.org>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org
Subject: [RFC PATCH v2 01/22] smb: client: Use PAGE_SIZE_MIN in the lock element build checks
Date: Wed,  2 Dec 2026 03:15:04 +0000	[thread overview]
Message-ID: <20261202031533.1665444-2-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261202031533.1665444-1-ericcurtin17@gmail.com>

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot be used in BUILD_BUG_ON().

Compare the size of the LOCKING_ANDX_RANGE and smb2_lock_element lock
buffers against PAGE_SIZE_MIN in cifs_push_mandatory_locks(),
cifs_unlock_range(), smb2_unlock_range() and
smb2_push_mandatory_locks(), so that the checks hold for every supported
page size. The run-time clamps that use PAGE_SIZE are unchanged.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 fs/smb/client/file.c     | 4 ++--
 fs/smb/client/smb2file.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index d272320436b3..dd572b3c2a65 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -2417,7 +2417,7 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
 	}
 
 	BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
-		     PAGE_SIZE);
+		     PAGE_SIZE_MIN);
 	max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
 			PAGE_SIZE);
 	max_num = (max_buf - sizeof(struct smb_hdr)) /
@@ -2793,7 +2793,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
 		return -EINVAL;
 
 	BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
-		     PAGE_SIZE);
+		     PAGE_SIZE_MIN);
 	max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
 			PAGE_SIZE);
 	max_num = (max_buf - sizeof(struct smb_hdr)) /
diff --git a/fs/smb/client/smb2file.c b/fs/smb/client/smb2file.c
index 764cfd894ad0..7640e35d44d1 100644
--- a/fs/smb/client/smb2file.c
+++ b/fs/smb/client/smb2file.c
@@ -314,7 +314,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
 	if (max_buf < sizeof(struct smb2_lock_element))
 		return -EINVAL;
 
-	BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+	BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE_MIN);
 	max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
 	max_num = max_buf / sizeof(struct smb2_lock_element);
 	buf = kzalloc_objs(struct smb2_lock_element, max_num);
@@ -457,7 +457,7 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
 		return -EINVAL;
 	}
 
-	BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+	BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE_MIN);
 	max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
 	max_num = max_buf / sizeof(struct smb2_lock_element);
 	buf = kzalloc_objs(struct smb2_lock_element, max_num);

  reply	other threads:[~2026-12-02  3:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02  3:15 ` Eric Curtin [this message]
2026-12-02  3:15 ` [RFC PATCH v2 02/22] fs/resctrl: Define the kernfs_ops as page-size variables Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 03/22] ocfs2: Use PAGE_SIZE_MIN/MAX for the page-count limits Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 04/22] ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 05/22] ntfs: Use PAGE_SIZE_MIN in NTFS_WOF_MAX_PAGES Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 06/22] nilfs2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 07/22] jfs: Use PAGE_SIZE_MAX to size the metapage anchor arrays Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 08/22] isofs: Use PAGE_SIZE_MAX for zisofs_sink_page Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 09/22] ext4: Use PAGE_SIZE_MAX for the inline KUnit test data buffer Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 10/22] ext2: Test PAGE_SIZE at run time in the rec_len conversions Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 11/22] erofs: Make the decompressor bounce buffers flexible arrays Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 12/22] ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 13/22] dlm: Use PAGE_SIZE_MIN in the lowcomms buffer size build check Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 14/22] cramfs: Allocate the read buffers at init time Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 15/22] ceph: Use PAGE_SHIFT_MIN in the ceph_fscrypt_blocks() build check Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 16/22] btrfs: Use PAGE_SIZE_MAX in a static_assert and min_t() for PAGE_SHIFT Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 17/22] afs: Use PAGE_SIZE_MAX to size struct afs_xdr_dir_page Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 18/22] fuse: Check CUSE and ioctl buffer sizes against PAGE_SIZE_MIN Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 19/22] btrfs: Use PAGE_SIZE_MAX and PAGE_SIZE_MIN for compile-time checks Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 20/22] NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 21/22] coredump: Use PAGE_SIZE_MIN for the zero-fill buffer Eric Curtin
2026-12-02  3:15 ` [RFC PATCH v2 22/22] fat: Use MAX_BUF_PER_PAGE_SIZE_MAX to size buffer_head arrays Eric Curtin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202031533.1665444-2-ericcurtin17@gmail.com \
    --to=ericcurtin17@gmail.com \
    --cc=bharathsm@microsoft.com \
    --cc=eric.curtin@docker.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=samba-technical@lists.samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®