diff mbox series

[3/6] sysctl: refactor __do_proc_doulongvec_minmax()

Message ID 20241123181244.183918-1-alexjlzheng@tencent.com (mailing list archive)
State New
Headers show
Series Maintain the relative size of fs.file-max and fs.nr_open | expand

Commit Message

Jinliang Zheng Nov. 23, 2024, 6:12 p.m. UTC
Extract the local variables min and max as parameters in
__do_proc_doulongvec_minmax() to facilitate code reuse in subsequent
patches. There are no functional changes.

Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
---
 kernel/sysctl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 79e6cb1d5c48..05b48b204ed4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1020,9 +1020,10 @@  static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
 static int __do_proc_doulongvec_minmax(void *data,
 		const struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos,
-		unsigned long convmul, unsigned long convdiv)
+		unsigned long convmul, unsigned long convdiv,
+		unsigned long *min, unsigned long *max)
 {
-	unsigned long *i, *min, *max;
+	unsigned long *i;
 	int vleft, first = 1, err = 0;
 	size_t left;
 	char *p;
@@ -1033,8 +1034,6 @@  static int __do_proc_doulongvec_minmax(void *data,
 	}
 
 	i = data;
-	min = table->extra1;
-	max = table->extra2;
 	vleft = table->maxlen / sizeof(unsigned long);
 	left = *lenp;
 
@@ -1095,8 +1094,10 @@  static int do_proc_doulongvec_minmax(const struct ctl_table *table, int write,
 		void *buffer, size_t *lenp, loff_t *ppos, unsigned long convmul,
 		unsigned long convdiv)
 {
+	unsigned long *min = table->extra1;
+	unsigned long *max = table->extra2;
 	return __do_proc_doulongvec_minmax(table->data, table, write,
-			buffer, lenp, ppos, convmul, convdiv);
+			buffer, lenp, ppos, convmul, convdiv, min, max);
 }
 
 /**