[RESEND PATCH v2 6/9] sysctl: delete these unnecessary static variables i_zero and i_one_hundred
From: wenyang . linux
Date: Tue Mar 19 2024 - 11:58:49 EST
From: Wen Yang <wenyang.linux@xxxxxxxxxxx>
Delete unnecessary static variables (i_zero and i_one_hundred)
and encode them directly in the table entry.
Signed-off-by: Wen Yang <wenyang.linux@xxxxxxxxxxx>
Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Joel Granados <j.granados@xxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
lib/test_sysctl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/test_sysctl.c b/lib/test_sysctl.c
index 9321d850931f..cf298f25d686 100644
--- a/lib/test_sysctl.c
+++ b/lib/test_sysctl.c
@@ -26,8 +26,6 @@
#include <linux/delay.h>
#include <linux/vmalloc.h>
-static int i_zero;
-static int i_one_hundred = 100;
static int match_int_ok = 1;
@@ -78,8 +76,9 @@ static struct ctl_table test_table[] = {
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = &i_zero,
- .extra2 = &i_one_hundred,
+ .min = SYSCTL_NUMERIC_ZERO,
+ .max = SYSCTL_NUMERIC_ONE_HUNDRED,
+ .extra_flags = SYSCTL_TABLE_EXTRA_LONG_INIT_MINMAX,
},
{
.procname = "int_0002",
@@ -108,8 +107,9 @@ static struct ctl_table test_table[] = {
.maxlen = sizeof(test_data.boot_int),
.mode = 0644,
.proc_handler = proc_dointvec,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE,
+ .min = SYSCTL_NUMERIC_ZERO,
+ .max = SYSCTL_NUMERIC_ONE,
+ .extra_flags = SYSCTL_TABLE_EXTRA_LONG_INIT_MINMAX,
},
{
.procname = "uint_0001",
--
2.25.1