lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 30 Oct 2017 14:25:06 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Douglas Anderson <dianders@...omium.org>
Cc:     Felipe Balbi <balbi@...nel.org>, johnyoun@...opsys.com,
        Stefan Wahren <stefan.wahren@...e.com>, amstan@...omium.org,
        linux-rockchip@...ts.infradead.org,
        Johan Hovold <johan@...nel.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Eric Anholt <eric@...olt.net>,
        Matthias Kaehlcke <mka@...omium.org>,
        John Stultz <john.stultz@...aro.org>,
        linux-rpi-kernel@...ts.infradead.org, jwerner@...omium.org,
        linux-usb@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] usb: dwc2: host: Convert hcd_queue to timer_setup

On Mon, Oct 30, 2017 at 10:08 AM, Douglas Anderson
<dianders@...omium.org> wrote:
> Convert the timers in hcd_queue to use the new timer_setup() call
> introduced in commit 686fef928bba ("timer: Prepare to change timer
> callback argument type").
>
> Suggested-by: Stefan Wahren <stefan.wahren@...e.com>
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> Cc: Kees Cook <keescook@...omium.org>

Acked-by: Kees Cook <keescook@...omium.org>

This matches my automated Coccinelle output for this code. (Actually,
it's better because it fixes the documentation too.) Please feel free
to take the patch into -next in advance of the global replacement.

Thanks!

-Kees

> ---
>
> Changes in v3:
> - Convert hcd_queue to timer_setup new for v3
>
>  drivers/usb/dwc2/hcd_queue.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
> index bea0aadd756e..6f5b5c8b0467 100644
> --- a/drivers/usb/dwc2/hcd_queue.c
> +++ b/drivers/usb/dwc2/hcd_queue.c
> @@ -1275,11 +1275,11 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
>   * release the reservation.  This worker is called after the appropriate
>   * delay.
>   *
> - * @work: Pointer to a qh unreserve_work.
> + * @t: Pointer to unreserve_timer in a qh.
>   */
> -static void dwc2_unreserve_timer_fn(unsigned long data)
> +static void dwc2_unreserve_timer_fn(struct timer_list *t)
>  {
> -       struct dwc2_qh *qh = (struct dwc2_qh *)data;
> +       struct dwc2_qh *qh = from_timer(qh, t, unreserve_timer);
>         struct dwc2_hsotg *hsotg = qh->hsotg;
>         unsigned long flags;
>
> @@ -1461,11 +1461,11 @@ static void dwc2_deschedule_periodic(struct dwc2_hsotg *hsotg,
>   * to retry some time later.  This function handles that timer and moves the
>   * qh back to the "inactive" list, then queues transactions.
>   *
> - * @data: Pointer to a qh to re-schedule.
> + * @t: Pointer to wait_timer in a qh.
>   */
> -static void dwc2_wait_timer_fn(unsigned long data)
> +static void dwc2_wait_timer_fn(struct timer_list *t)
>  {
> -       struct dwc2_qh *qh = (struct dwc2_qh *)data;
> +       struct dwc2_qh *qh = from_timer(qh, t, wait_timer);
>         struct dwc2_hsotg *hsotg = qh->hsotg;
>         unsigned long flags;
>
> @@ -1518,9 +1518,8 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
>
>         /* Initialize QH */
>         qh->hsotg = hsotg;
> -       setup_timer(&qh->unreserve_timer, dwc2_unreserve_timer_fn,
> -                   (unsigned long)qh);
> -       setup_timer(&qh->wait_timer, dwc2_wait_timer_fn, (unsigned long)qh);
> +       timer_setup(&qh->unreserve_timer, dwc2_unreserve_timer_fn, 0);
> +       timer_setup(&qh->wait_timer, dwc2_wait_timer_fn, 0);
>         qh->ep_type = ep_type;
>         qh->ep_is_in = ep_is_in;
>
> --
> 2.15.0.rc2.357.g7e34df9404-goog
>



-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ