OSDN Git Service

net/core: Collapse redundant sk_timer callback data assignments
authorKees Cook <keescook@chromium.org>
Tue, 17 Oct 2017 00:29:21 +0000 (17:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 11:39:55 +0000 (12:39 +0100)
The core sk_timer initializer can provide the common .data assignment
instead of it being set separately in users.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: linzhang <xiaolou4617@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: linux-x25@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c
net/netrom/nr_timer.c
net/rose/rose_timer.c
net/x25/af_x25.c
net/x25/x25_timer.c

index 23953b7..f577df1 100644 (file)
@@ -2683,7 +2683,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
        sk_init_common(sk);
        sk->sk_send_head        =       NULL;
 
-       init_timer(&sk->sk_timer);
+       setup_timer(&sk->sk_timer, NULL, (unsigned long)sk);
 
        sk->sk_allocation       =       GFP_KERNEL;
        sk->sk_rcvbuf           =       sysctl_rmem_default;
index 94d0580..f84ce71 100644 (file)
@@ -45,7 +45,6 @@ void nr_init_timers(struct sock *sk)
        setup_timer(&nr->idletimer, nr_idletimer_expiry, (unsigned long)sk);
 
        /* initialized by sock_init_data */
-       sk->sk_timer.data     = (unsigned long)sk;
        sk->sk_timer.function = &nr_heartbeat_expiry;
 }
 
index 3b89d66..e082011 100644 (file)
@@ -36,7 +36,6 @@ void rose_start_heartbeat(struct sock *sk)
 {
        del_timer(&sk->sk_timer);
 
-       sk->sk_timer.data     = (unsigned long)sk;
        sk->sk_timer.function = &rose_heartbeat_expiry;
        sk->sk_timer.expires  = jiffies + 5 * HZ;
 
index ac09593..c590c0b 100644 (file)
@@ -414,7 +414,6 @@ static void __x25_destroy_socket(struct sock *sk)
                /* Defer: outstanding buffers */
                sk->sk_timer.expires  = jiffies + 10 * HZ;
                sk->sk_timer.function = x25_destroy_timer;
-               sk->sk_timer.data = (unsigned long)sk;
                add_timer(&sk->sk_timer);
        } else {
                /* drop last reference so sock_put will free */
index 5c5db1a..de5cec4 100644 (file)
@@ -36,7 +36,6 @@ void x25_init_timers(struct sock *sk)
        setup_timer(&x25->timer, x25_timer_expiry, (unsigned long)sk);
 
        /* initialized by sock_init_data */
-       sk->sk_timer.data     = (unsigned long)sk;
        sk->sk_timer.function = &x25_heartbeat_expiry;
 }