From patchwork Mon Oct 16 22:51:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 06F47601D5 for ; Mon, 16 Oct 2017 22:51:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC2A62864A for ; Mon, 16 Oct 2017 22:51:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0D79286D9; Mon, 16 Oct 2017 22:51:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 699CC2864A for ; Mon, 16 Oct 2017 22:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757127AbdJPWvR (ORCPT ); Mon, 16 Oct 2017 18:51:17 -0400 Received: from mail-pf0-f172.google.com ([209.85.192.172]:45227 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757118AbdJPWvQ (ORCPT ); Mon, 16 Oct 2017 18:51:16 -0400 Received: by mail-pf0-f172.google.com with SMTP id d28so16885629pfe.2 for ; Mon, 16 Oct 2017 15:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=zqv+lWrziYUfBAfXfhq4GVcW91pmhfefhLbkAqoxVnQ=; b=FQI5KcDt9NS498gOVX5d/9x4jwBWAAL0z+6bVr1mhVXbcMJPF7YQtKC4uimSk7dCK7 VAFSscMxqAz6rdsaxW2KymRu98W9V5aaGBcK8T9KsJD9zF7VzY2B1Kpmm022+CwVAels LAdqhBPnkESpwnWFoqRgHWmwYODHY84wmapZ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=zqv+lWrziYUfBAfXfhq4GVcW91pmhfefhLbkAqoxVnQ=; b=AoXMAvjI1910hPJ6Z5VrrHjMfOsSpxHnDERNreSBuVf0KPujuHxKwem6sOhxxkIQNI j/Fhs8Nn8DQPsZ0phoUwDf92OaG0m9YB/4IDVpKtd030qtmIr2LL8OZUL9HaQYPqo8J/ Y43va6xG9mjLqXGOHWmohlHYLov6dsl6HjuudWinuSwMBdbMyfoOsSAjpeoxeUsZL3eW YFahjh/K1xlKswAPwxLmLi3OS764rmuTvVKaYdGa8HJKHhvpWCKsNG/J6FhNX4Gfybcq VRKm1ogoU3ailmxG8rDFku+ke25lANLKuhAPvGtPyKAPqIVKt3NnRitFB025vBQ72t65 n5HA== X-Gm-Message-State: AMCzsaV9ou6fbpsUW4jDq6SblyMYBz7wcKetP8rKvsZ9+eO5iV8Wh7Fh xcJ+/3ZYzt8CTngXo0GelRSKgw== X-Google-Smtp-Source: ABhQp+QK9VoUiq0hi8MQ7Adc4G/0DiJtHcIbv+HVRrHiHYoe6tmlWhemsDVyVxs232iDjrdzhf1TPg== X-Received: by 10.84.131.197 with SMTP id d63mr4574704pld.414.1508194276025; Mon, 16 Oct 2017 15:51:16 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id b28sm17553167pfl.86.2017.10.16.15.51.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 15:51:14 -0700 (PDT) Date: Mon, 16 Oct 2017 15:51:13 -0700 From: Kees Cook To: Doug Ledford Cc: Dennis Dalessandro , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/rdmavt: Convert timers to use timer_setup() Message-ID: <20171016225113.GA98749@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. setup_timer() was already being called before the open-coded init_timer() and .data assignment. These are removed as well. Cc: Dennis Dalessandro Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Signed-off-by: Kees Cook --- drivers/infiniband/sw/rdmavt/qp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c index b8e904905f47..af3967f7d1b5 100644 --- a/drivers/infiniband/sw/rdmavt/qp.c +++ b/drivers/infiniband/sw/rdmavt/qp.c @@ -57,7 +57,7 @@ #include "vt.h" #include "trace.h" -static void rvt_rc_timeout(unsigned long arg); +static void rvt_rc_timeout(struct timer_list *t); /* * Convert the AETH RNR timeout code into the number of microseconds. @@ -845,7 +845,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, goto bail_qp; } /* initialize timers needed for rc qp */ - setup_timer(&qp->s_timer, rvt_rc_timeout, (unsigned long)qp); + timer_setup(&qp->s_timer, rvt_rc_timeout, 0); hrtimer_init(&qp->s_rnr_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); qp->s_rnr_timer.function = rvt_rc_rnr_retry; @@ -894,8 +894,6 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd, atomic_set(&qp->refcount, 0); atomic_set(&qp->local_ops_pending, 0); init_waitqueue_head(&qp->wait); - init_timer(&qp->s_timer); - qp->s_timer.data = (unsigned long)qp; INIT_LIST_HEAD(&qp->rspwait); qp->state = IB_QPS_RESET; qp->s_wq = swq; @@ -2132,9 +2130,9 @@ EXPORT_SYMBOL(rvt_del_timers_sync); /** * This is called from s_timer for missing responses. */ -static void rvt_rc_timeout(unsigned long arg) +static void rvt_rc_timeout(struct timer_list *t) { - struct rvt_qp *qp = (struct rvt_qp *)arg; + struct rvt_qp *qp = from_timer(qp, t, s_timer); struct rvt_dev_info *rdi = ib_to_rvt(qp->ibqp.device); unsigned long flags;