Re: [PATCH 31/31] timer: Switch to testing for .function instead of .data

From: Rafael J. Wysocki
Date: Sat Sep 02 2017 - 09:56:21 EST


On Friday, September 1, 2017 1:29:43 AM CEST Kees Cook wrote:
> In several places, .data is checked for initialization to gate early
> calls to del_timer_sync(). Checking for .function is equally valid, so
> switch to this in all callers.
>
> Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>
> Cc: Pavel Machek <pavel@xxxxxx>
> Cc: Len Brown <len.brown@xxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>
> Cc: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
> Cc: Doug Ledford <dledford@xxxxxxxxxx>
> Cc: Sean Hefty <sean.hefty@xxxxxxxxx>
> Cc: Hal Rosenstock <hal.rosenstock@xxxxxxxxx>
> Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Cc: linux-rdma@xxxxxxxxxxxxxxx
> Cc: linux-input@xxxxxxxxxxxxxxx
> Cc: intel-wired-lan@xxxxxxxxxxxxxxxx
> Cc: netdev@xxxxxxxxxxxxxxx
> Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
> ---
> drivers/base/power/wakeup.c | 3 +--
> drivers/infiniband/hw/hfi1/chip.c | 6 ++----
> drivers/infiniband/hw/hfi1/init.c | 2 +-
> drivers/infiniband/hw/qib/qib_iba7220.c | 2 +-
> drivers/infiniband/hw/qib/qib_iba7322.c | 2 +-
> drivers/infiniband/hw/qib/qib_init.c | 14 +++++---------
> drivers/infiniband/hw/qib/qib_mad.c | 2 +-
> drivers/input/input.c | 5 ++---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
> 9 files changed, 15 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
> index 144e6d8fafc8..79a3c1b204af 100644
> --- a/drivers/base/power/wakeup.c
> +++ b/drivers/base/power/wakeup.c
> @@ -479,8 +479,7 @@ static bool wakeup_source_not_registered(struct wakeup_source *ws)
> * Use timer struct to check if the given source is initialized
> * by wakeup_source_add.
> */
> - return ws->timer.function != pm_wakeup_timer_fn ||
> - ws->timer.data != (unsigned long)ws;
> + return ws->timer.function != pm_wakeup_timer_fn;
> }
>
> /*

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>

for the above.

Thanks!