lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250819130817.845-1-luochunsheng@ustc.edu>
Date: Tue, 19 Aug 2025 21:08:17 +0800
From: Chunsheng Luo <luochunsheng@...c.edu>
To: miklos@...redi.hu
Cc: linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Chunsheng Luo <luochunsheng@...c.edu>
Subject: [PATCH] fuse: Replace hardcoded 4096 with PAGE_SIZE

Replace hardcoded 4096 values with PAGE_SIZE macro in FUSE
filesystem for better portability across different architectures.

This improves code maintainability and ensures proper alignment with
the system's page size, which may vary on different architectures
(e.g., 4KB on x86, 64KB on some ARM64 systems).

The functionality remains unchanged on systems with 4KB pages while
providing better compatibility for systems with different page sizes.

Signed-off-by: Chunsheng Luo <luochunsheng@...c.edu>
---
 fs/fuse/cuse.c  | 4 ++--
 fs/fuse/inode.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index b39844d75a80..f4770ad627a8 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -337,8 +337,8 @@ static void cuse_process_init_reply(struct fuse_mount *fm,
 		goto err;
 
 	fc->minor = arg->minor;
-	fc->max_read = max_t(unsigned, arg->max_read, 4096);
-	fc->max_write = max_t(unsigned, arg->max_write, 4096);
+	fc->max_read = max_t(unsigned int, arg->max_read, PAGE_SIZE);
+	fc->max_write = max_t(unsigned int, arg->max_write, PAGE_SIZE);
 
 	/* parse init reply */
 	cc->unrestricted_ioctl = arg->flags & CUSE_UNRESTRICTED_IOCTL;
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index ecb869e895ab..8de2e969924e 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1454,8 +1454,8 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
 		fm->sb->s_bdi->ra_pages =
 				min(fm->sb->s_bdi->ra_pages, ra_pages);
 		fc->minor = arg->minor;
-		fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
-		fc->max_write = max_t(unsigned, 4096, fc->max_write);
+		fc->max_write = arg->minor < 5 ? PAGE_SIZE : arg->max_write;
+		fc->max_write = max_t(unsigned int, PAGE_SIZE, fc->max_write);
 		fc->conn_init = 1;
 	}
 	kfree(ia);
@@ -1847,7 +1847,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
 	fc->user_id = ctx->user_id;
 	fc->group_id = ctx->group_id;
 	fc->legacy_opts_show = ctx->legacy_opts_show;
-	fc->max_read = max_t(unsigned int, 4096, ctx->max_read);
+	fc->max_read = max_t(unsigned int, PAGE_SIZE, ctx->max_read);
 	fc->destroy = ctx->destroy;
 	fc->no_control = ctx->no_control;
 	fc->no_force_umount = ctx->no_force_umount;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ