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: <1741951.WK9IEl5h0a@diego>
Date:   Thu, 24 Sep 2020 08:41:36 +0200
From:   Heiko Stübner <heiko@...ech.de>
To:     Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
        Elaine Zhang <zhangqing@...k-chips.com>
Subject: Re: [PATCH] clk: rockchip: Initialize hw to error to avoid undefined behavior

Am Donnerstag, 24. September 2020, 02:44:41 CEST schrieb Stephen Boyd:
> We can get down to this return value from ERR_CAST() without
> initializing hw. Set it to -ENOMEM so that we always return something
> sane.
> 
> Fixes the following smatch warning:
> 
> drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() error: uninitialized symbol 'hw'.
> drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() warn: passing zero to 'ERR_CAST'
> 
> Cc: Elaine Zhang <zhangqing@...k-chips.com>
> Cc: Heiko Stuebner <heiko@...ech.de>
> Fixes: 956060a52795 ("clk: rockchip: add support for half divider")
> Signed-off-by: Stephen Boyd <sboyd@...nel.org>

Reviewed-by: Heiko Stuebner <heiko@...ech.de>


> ---
>  drivers/clk/rockchip/clk-half-divider.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/rockchip/clk-half-divider.c b/drivers/clk/rockchip/clk-half-divider.c
> index e97fd3dfbae7..ccd5c270c213 100644
> --- a/drivers/clk/rockchip/clk-half-divider.c
> +++ b/drivers/clk/rockchip/clk-half-divider.c
> @@ -166,7 +166,7 @@ struct clk *rockchip_clk_register_halfdiv(const char *name,
>  					  unsigned long flags,
>  					  spinlock_t *lock)
>  {
> -	struct clk_hw *hw;
> +	struct clk_hw *hw = ERR_PTR(-ENOMEM);
>  	struct clk_mux *mux = NULL;
>  	struct clk_gate *gate = NULL;
>  	struct clk_divider *div = NULL;
> 
> base-commit: ca52a47af60f791b08a540a8e14d8f5751ee63e9
> 




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ