From: Wen Yang <wenyang.linux@foxmail.com>
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@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: David Howells <dhowells@redhat.com>
Cc: Marc Dionne <marc.dionne@auristor.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
net/rxrpc/sysctl.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
@@ -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,
},
{ }
};