2024-02-25 04:06:51

by Wen Yang

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

From: Wen Yang <[email protected]>

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 <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Joel Granados <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: David Howells <[email protected]>
Cc: Marc Dionne <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: [email protected]
---
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