2024-03-09 10:33:32

by Wen Yang

[permalink] [raw]
Subject: [PATCH v2 6/9] sysctl: delete these unnecessary static variables i_zero and i_one_hundred

From: Wen Yang <[email protected]>

Delete unnecessary static variables (i_zero and i_one_hundred)
and encode them directly in the table entry.

Signed-off-by: Wen Yang <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: [email protected]
---
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