From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753127AbdJEAyB (ORCPT ); Wed, 4 Oct 2017 20:54:01 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:47604 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbdJEAx4 (ORCPT ); Wed, 4 Oct 2017 20:53:56 -0400 X-Google-Smtp-Source: AOwi7QD387OyaZS3fp2KayHK6PCAHMVvxK5DZUD2AARU0kwyUjLslAC4zcXt4eD8iGcEy2Xo6Ov7LQ== Date: Wed, 4 Oct 2017 17:53:54 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Thomas Gleixner Subject: [PATCH] tty/sysrq: Convert timers to use timer_setup() Message-ID: <20171005005354.GA23852@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/tty/sysrq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 3ffc1ce29023..8fe2ce06a35f 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c @@ -648,9 +648,9 @@ static void sysrq_parse_reset_sequence(struct sysrq_state *state) state->reset_seq_version = sysrq_reset_seq_version; } -static void sysrq_do_reset(unsigned long _state) +static void sysrq_do_reset(struct timer_list *t) { - struct sysrq_state *state = (struct sysrq_state *) _state; + struct sysrq_state *state = from_timer(state, t, keyreset_timer); state->reset_requested = true; @@ -667,7 +667,7 @@ static void sysrq_handle_reset_request(struct sysrq_state *state) mod_timer(&state->keyreset_timer, jiffies + msecs_to_jiffies(sysrq_reset_downtime_ms)); else - sysrq_do_reset((unsigned long)state); + sysrq_do_reset(&state->keyreset_timer); } static void sysrq_detect_reset_sequence(struct sysrq_state *state, @@ -903,8 +903,7 @@ static int sysrq_connect(struct input_handler *handler, sysrq->handle.handler = handler; sysrq->handle.name = "sysrq"; sysrq->handle.private = sysrq; - setup_timer(&sysrq->keyreset_timer, - sysrq_do_reset, (unsigned long)sysrq); + timer_setup(&sysrq->keyreset_timer, sysrq_do_reset, 0); error = input_register_handle(&sysrq->handle); if (error) { -- 2.7.4 -- Kees Cook Pixel Security