[6/8] epoll: delete these duplicate static variables long_zero and long_max

Message ID tencent_D3D0CC5A7E63CF04557ED42E411D9379E908@qq.com
State New
Headers
Series [1/8] sysctl: introduce sysctl SYSCTL_U8_MAX and SYSCTL_LONG_S32_MAX |

Commit Message

Wen Yang Feb. 25, 2024, 4:05 a.m. UTC
  From: Wen Yang <wenyang.linux@foxmail.com>

Since these static variables (long_zero and long_max) are only used for
boundary checks and will not be changed, remove it and use the ones in
our shared const array.

Signed-off-by: Wen Yang <wenyang.linux@foxmail.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Joel Granados <j.granados@samsung.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-kernel@vger.kernel.org
---
 fs/eventpoll.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Patch

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3534d36a1474..22864d6de04f 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -309,9 +309,6 @@  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",
@@ -319,8 +316,8 @@  static struct ctl_table epoll_table[] = {
 		.maxlen		= sizeof(max_user_watches),
 		.mode		= 0644,
 		.proc_handler	= proc_doulongvec_minmax,
-		.extra1		= &long_zero,
-		.extra2		= &long_max,
+		.extra1		= SYSCTL_LONG_ZERO,
+		.extra2		= SYSCTL_LONG_MAX,
 	},
 };