[PATCH v3 2/3] sysctl/coda: Fixes timeout bounds

[email protected]
Newsgroups gmane.linux.nfs,gmane.linux.kernel,gmane.comp.file-systems.coda.general
Message-ID <[email protected]>
From: Nicolas Bouchinet <[email protected]>

Bound coda timeout sysctl writings between SYSCTL_ZERO
and SYSCTL_INT_MAX.

The proc_handler has thus been updated to proc_dointvec_minmax.

coda_timeout type has been updated from an unsigned long to an unsigned
int since it is typically set to some value well under a minute.

Signed-off-by: Nicolas Bouchinet <[email protected]>

---

Changes since v2:
https://lore.kernel.org/all/20250224095826.16458-4-nicolas.bouchinet-eo0qJZqvLYFAfugRpC6u6w@public.gmane.org/

* Changed coda_timeout type from unsigned long to unsigned int as
  suggested by Joel Granados and Jan Harkes.

---
 fs/coda/coda_int.h | 2 +-
 fs/coda/sysctl.c   | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/coda/coda_int.h b/fs/coda/coda_int.h
index f82b59c9dd287..c7fc4c5a77d58 100644
--- a/fs/coda/coda_int.h
+++ b/fs/coda/coda_int.h
@@ -6,7 +6,7 @@ struct dentry;
 struct file;
 
 extern struct file_system_type coda_fs_type;
-extern unsigned long coda_timeout;
+extern unsigned int coda_timeout;
 extern int coda_hard;
 extern int coda_fake_statfs;
 
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 0df46f09b6cc5..d6f8206c51575 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -20,7 +20,9 @@ static const struct ctl_table coda_table[] = {
 		.data		= &coda_timeout,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= SYSCTL_ZERO,
+		.extra2		= SYSCTL_INT_MAX,
 	},
 	{
 		.procname	= "hard",
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.