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] [day] [month] [year] [list]
Message-ID: <CAM_iQpX33ZTz0UHwcpH7ehFE4MjmB14fuLHHRFkVYYOqv+FCwA@mail.gmail.com>
Date:   Thu, 11 Jun 2020 13:50:20 -0700
From:   Cong Wang <xiyou.wangcong@...il.com>
To:     Davide Caratti <dcaratti@...hat.com>
Cc:     Po Liu <Po.Liu@....com>, "David S. Miller" <davem@...emloft.net>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>
Subject: Re: [PATCH net 2/2] net/sched: act_gate: fix configuration of the
 periodic timer

On Wed, Jun 10, 2020 at 2:43 PM Davide Caratti <dcaratti@...hat.com> wrote:
> +static void gate_setup_timer(struct tcf_gate *gact, u64 basetime,
> +                            enum tk_offsets tko, s32 clockid,
> +                            bool do_init)
> +{
> +       bool timer_change = basetime != gact->param.tcfg_basetime ||
> +                           tko != gact->tk_offset ||
> +                           clockid != gact->param.tcfg_clockid;
> +
> +       if (!do_init) {
> +               if (timer_change) {
> +                       spin_unlock_bh(&gact->tcf_lock);
> +                       hrtimer_cancel(&gact->hitimer);
> +                       spin_lock_bh(&gact->tcf_lock);
> +                       goto init_hitimer;
> +               }
> +               return;
> +       }
> +
> +init_hitimer:
> +       gact->param.tcfg_basetime = basetime;
> +       gact->param.tcfg_clockid = clockid;
> +       gact->tk_offset = tko;
> +       hrtimer_init(&gact->hitimer, clockid, HRTIMER_MODE_ABS_SOFT);
> +       gact->hitimer.function = gate_timer_func;
> +}

This function would be more readable if you rewrite it like this:

if (!do_init && !timer_change)
  return;
if (timer_change) {
...
}
...

The rest looks good to me.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ