Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbdHaXmL (ORCPT ); Thu, 31 Aug 2017 19:42:11 -0400 Received: from mail-pg0-f45.google.com ([74.125.83.45]:37587 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbdHaXjU (ORCPT ); Thu, 31 Aug 2017 19:39:20 -0400 X-Google-Smtp-Source: ADKCNb7RoBTxsnKYeJzfRaNvCO92X+9lu0XzJVnm21od+KCHtWHaakK6WDL1HKQ3iCQsdtS3vGNyjg== From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , "David S. Miller" , Ralf Baechle , Andrew Hendry , Eric Dumazet , Paolo Abeni , David Howells , Colin Ian King , Ingo Molnar , linzhang , netdev@vger.kernel.org, linux-hams@vger.kernel.org, linux-x25@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 20/31] net/core: Collapse redundant sk_timer callback data assignments Date: Thu, 31 Aug 2017 16:29:32 -0700 Message-Id: <1504222183-61202-21-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504222183-61202-1-git-send-email-keescook@chromium.org> References: <1504222183-61202-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2927 Lines: 87 The core sk_timer initializer can provide the common .data assignment instead of it being set separately in users. Cc: "David S. Miller" Cc: Ralf Baechle Cc: Andrew Hendry Cc: Eric Dumazet Cc: Paolo Abeni Cc: David Howells Cc: Colin Ian King Cc: Ingo Molnar Cc: linzhang Cc: netdev@vger.kernel.org Cc: linux-hams@vger.kernel.org Cc: linux-x25@vger.kernel.org Signed-off-by: Kees Cook --- net/core/sock.c | 2 +- net/netrom/nr_timer.c | 1 - net/rose/rose_timer.c | 1 - net/x25/af_x25.c | 1 - net/x25/x25_timer.c | 1 - 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index ac2a404c73eb..5281a998ab32 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -2623,7 +2623,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; diff --git a/net/netrom/nr_timer.c b/net/netrom/nr_timer.c index 94d05806a9a2..f84ce71f1f5f 100644 --- a/net/netrom/nr_timer.c +++ b/net/netrom/nr_timer.c @@ -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; } diff --git a/net/rose/rose_timer.c b/net/rose/rose_timer.c index bc5469d6d9cb..6baa415b199a 100644 --- a/net/rose/rose_timer.c +++ b/net/rose/rose_timer.c @@ -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; diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5a1a98df3499..a5ac385b9120 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -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 */ diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c index 5c5db1a36399..de5cec41d100 100644 --- a/net/x25/x25_timer.c +++ b/net/x25/x25_timer.c @@ -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; } -- 2.7.4