[PATCH 2/8] rxrpc: delete these duplicate static variables n_65535 and four

From: wenyang . linux
Date: Sat Feb 24 2024 - 23:06:52 EST


From: Wen Yang <wenyang.linux@xxxxxxxxxxx>

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

Signed-off-by: Wen Yang <wenyang.linux@xxxxxxxxxxx>
Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Joel Granados <j.granados@xxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: David Howells <dhowells@xxxxxxxxxx>
Cc: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: Eric Dumazet <edumazet@xxxxxxxxxx>
Cc: Jakub Kicinski <kuba@xxxxxxxxxx>
Cc: Paolo Abeni <pabeni@xxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
net/rxrpc/sysctl.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
index ecaeb4ecfb58..4e2230cf6ff6 100644
--- a/net/rxrpc/sysctl.c
+++ b/net/rxrpc/sysctl.c
@@ -11,9 +11,7 @@
#include "ar-internal.h"

static struct ctl_table_header *rxrpc_sysctl_reg_table;
-static const unsigned int four = 4;
static const unsigned int max_backlog = RXRPC_BACKLOG_MAX - 1;
-static const unsigned int n_65535 = 65535;
static const unsigned int n_max_acks = 255;
static const unsigned long one_jiffy = 1;
static const unsigned long max_jiffies = MAX_JIFFY_OFFSET;
@@ -86,8 +84,8 @@ static struct ctl_table rxrpc_sysctl_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)SYSCTL_ONE,
- .extra2 = (void *)&n_65535,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_U16_MAX,
},
{
.procname = "max_backlog",
@@ -95,7 +93,7 @@ static struct ctl_table rxrpc_sysctl_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)&four,
+ .extra1 = SYSCTL_FOUR,
.extra2 = (void *)&max_backlog,
},
{
@@ -113,8 +111,8 @@ static struct ctl_table rxrpc_sysctl_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)SYSCTL_ONE,
- .extra2 = (void *)&n_65535,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_U16_MAX,
},
{
.procname = "rx_jumbo_max",
@@ -122,8 +120,8 @@ static struct ctl_table rxrpc_sysctl_table[] = {
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
- .extra1 = (void *)SYSCTL_ONE,
- .extra2 = (void *)&four,
+ .extra1 = SYSCTL_ONE,
+ .extra2 = SYSCTL_FOUR,
},
{ }
};
--
2.25.1