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]
Message-ID: <384bf6c936fac50042389cc5f53c3199.sboyd@kernel.org>
Date: Fri, 08 Mar 2024 17:06:09 -0800
From: Stephen Boyd <sboyd@...nel.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Michael Turquette <mturquette@...libre.com>, Christophe JAILLET <christophe.jaillet@...adoo.fr>, Heiko Stuebner <heiko@...ech.de>, Andy Shevchenko <andy.shevchenko@...il.com>
Subject: Re: [PATCH v1 1/1] clk: fractional-divider: Move mask calculations out of lock

Quoting Andy Shevchenko (2024-03-03 04:14:10)
> There is no need to calculate masks under the lock taken.
> Move them out of it.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@...il.com>
> ---

Applied to clk-next

> diff --git a/drivers/clk/clk-fractional-divider.c b/drivers/clk/clk-fractional-divider.c
> index a0178182fc72..da057172cc90 100644
> --- a/drivers/clk/clk-fractional-divider.c
> +++ b/drivers/clk/clk-fractional-divider.c
> @@ -195,14 +195,14 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
>                 n--;
>         }
>  
> +       mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
> +       nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
> +
>         if (fd->lock)
>                 spin_lock_irqsave(fd->lock, flags);
>         else
>                 __acquire(fd->lock);
>  
> -       mmask = GENMASK(fd->mwidth - 1, 0) << fd->mshift;
> -       nmask = GENMASK(fd->nwidth - 1, 0) << fd->nshift;
> -
>         val = clk_fd_readl(fd);
>         val &= ~(mmask | nmask);
>         val |= (m << fd->mshift) | (n << fd->nshift);

Should we pre-calculate the mask and shift values too!?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ