[RFC PATCH v2 04/22] ntfs3: Use MAX_BUF_PER_PAGE_SIZE_MAX for struct ntfs_buffers

From: Eric Curtin

Date: Tue Dec 01 2026 - 22:16:08 EST


From: Eric Curtin <eric.curtin@xxxxxxxxxx>

With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so PAGE_SIZE >> SECTOR_SHIFT cannot size the bh[] array in
struct ntfs_buffers.

Use MAX_BUF_PER_PAGE_SIZE_MAX, the number of 512-byte buffers in the
largest supported page, which is what the old expression evaluated to
for a fixed page size.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/ntfs3/ntfs_fs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 16e7eab3e16d..c742a2b9525b 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -130,7 +130,7 @@ struct runs_tree {
struct ntfs_buffers {
/* Biggest MFT / smallest cluster = 4096 / 512 = 8 */
/* Biggest index / smallest cluster = 4096 / 512 = 8 */
- struct buffer_head *bh[PAGE_SIZE >> SECTOR_SHIFT];
+ struct buffer_head *bh[MAX_BUF_PER_PAGE_SIZE_MAX];
u32 bytes;
u32 nbufs;
u32 off;