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: <155389932276.20095.12054188967513679921@swboyd.mtv.corp.google.com>
Date:   Fri, 29 Mar 2019 15:42:02 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     jbrunet@...libre.com, mturquette@...libre.com,
        nixiaoming@...wei.com, rnayak@...com, sboyd@...eaurora.org,
        soren.brinkmann@...inx.com
Cc:     linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] clk:Fix divide by 0 error in divider_ro_round_rate_parent

Quoting nixiaoming (2019-03-29 02:05:24)
> In the function divider_recalc_rate The judgment of the return value of

Please write divider_recalc_rate() with parenthesis to show it's a
function.

> _get_div indicates that the return value of _get_div may be 0.

__get_div()

> In order to avoid the divide-by-zero error, add check the return value
> of _get_div in the divider_ro_round_rate_parent
> 
> Signed-off-by: nixiaoming <nixiaoming@...wei.com>

Is this your name? nixiaoming? Or is it written some other way?

> ---
>  drivers/clk/clk-divider.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
> index e5a1726..0854e3e 100644
> --- a/drivers/clk/clk-divider.c
> +++ b/drivers/clk/clk-divider.c
> @@ -347,6 +347,8 @@ long divider_ro_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent,
>         int div;
>  
>         div = _get_div(table, val, flags, width);
> +       if (!div) /* avoid divide-by-zero */
> +               return -EINVAL;

How does _get_div() return 0? What is the value of 'flags' here when
this goes wrong?

>  
>         /* Even a read-only clock can propagate a rate change */
>         if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
> -- 
> 1.8.5.6
> 

Wow that's a 5 year old version of git!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ