[PATCH v2 7/9] epoll: delete these unnecessary static variables long_zero and long_max

From: wenyang . linux
Date: Sat Mar 09 2024 - 05:33:43 EST


From: Wen Yang <wenyang.linux@xxxxxxxxxxx>

Delete unnecessary static variables (long_zero and long_max)
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: Jan Kara <jack@xxxxxxx>
Cc: "Darrick J. Wong" <djwong@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
fs/eventpoll.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3534d36a1474..7cfc4fb0ca3c 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -309,19 +309,14 @@ static void unlist_file(struct epitems_head *head)

#include <linux/sysctl.h>

-static long long_zero;
-static long long_max = LONG_MAX;
-
static struct ctl_table epoll_table[] = {
- {
- .procname = "max_user_watches",
- .data = &max_user_watches,
- .maxlen = sizeof(max_user_watches),
- .mode = 0644,
- .proc_handler = proc_doulongvec_minmax,
- .extra1 = &long_zero,
- .extra2 = &long_max,
- },
+ CTL_TABLE_ENTRY_MINMAX("max_user_watches",
+ &max_user_watches,
+ sizeof(max_user_watches),
+ 0644,
+ proc_doulongvec_minmax,
+ SYSCTL_NUMERIC_ZERO,
+ SYSCTL_NUMERIC_LONG_MAX),
};

static void __init epoll_sysctls_init(void)
--
2.25.1