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: <20180905233757.GB22824@google.com>
Date:   Wed, 5 Sep 2018 16:37:57 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Douglas Anderson <dianders@...omium.org>
Cc:     Andy Gross <andy.gross@...aro.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        girishm@...eaurora.org, dkota@...eaurora.org, evgreen@...omium.org,
        swboyd@...omium.org, linux-arm-msm@...r.kernel.org,
        linux-soc@...r.kernel.org, David Brown <david.brown@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] soc: qcom: geni: Don't ignore clk_round_rate()
 errors in geni_se_clk_tbl_get()

On Thu, Aug 30, 2018 at 11:36:11AM -0700, Douglas Anderson wrote:
> The function clk_round_rate() is defined to return a "long", not an
> "unsigned long".  That's because it might return a negative error
> code.  Change the call in geni_se_clk_tbl_get() to check for errors.
> 
> NOTE: overall the idea that we should iterate over clk_round_rate() to
> try to reconstruct a table already present in the clock driver is
> questionable.  Specifically:
> - This method relies on "clk_round_rate()" rounding up.
> - This method only works if the table is sorted and has no duplicates.
> ...this patch doesn't try to fix those problems, it just makes the
> error handling more correct.
> 
> Fixes: eddac5af0654 ("soc: qcom: Add GENI based QUP Wrapper driver")
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
> 
>  drivers/soc/qcom/qcom-geni-se.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
> index feed3db21c10..1b19b8428c4a 100644
> --- a/drivers/soc/qcom/qcom-geni-se.c
> +++ b/drivers/soc/qcom/qcom-geni-se.c
> @@ -513,7 +513,7 @@ EXPORT_SYMBOL(geni_se_resources_on);
>   */
>  int geni_se_clk_tbl_get(struct geni_se *se, unsigned long **tbl)
>  {
> -	unsigned long freq = 0;
> +	long freq = 0;

nit: Since you are already touching this you could also remove the
pointless initialization, 'freq' is always assigned before it is used.

>  	int i;
>  
>  	if (se->clk_perf_tbl) {
> @@ -529,7 +529,7 @@ int geni_se_clk_tbl_get(struct geni_se *se, unsigned long **tbl)
>  
>  	for (i = 0; i < MAX_CLK_PERF_LEVEL; i++) {
>  		freq = clk_round_rate(se->clk, freq + 1);
> -		if (!freq || freq == se->clk_perf_tbl[i - 1])
> +		if (freq <= 0 || freq == se->clk_perf_tbl[i - 1])
>  			break;
>  		se->clk_perf_tbl[i] = freq;
>  	}

Reviewed-by: Matthias Kaehlcke <mka@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ