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: <c1065c2f-3e7e-e2c4-a9f5-e672e86beb43@gmail.com>
Date:   Fri, 14 Dec 2018 23:29:30 +0100
From:   Marek Vasut <marek.vasut@...il.com>
To:     Stephen Boyd <sboyd@...nel.org>,
        Michael Turquette <mturquette@...libre.com>
Cc:     linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
        Marek Vasut <marek.vasut+renesas@...il.com>,
        Alexey Firago <alexey_firago@...tor.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH] clk: vc5: Initialize src in vc5_mux_set_parent()

On 12/14/2018 10:49 PM, Stephen Boyd wrote:
> It seems that it may be possible to get to the regmap update call
> without ever initializing this variable, so just set it to 0 to be safe.
> 
> Cc: Marek Vasut <marek.vasut+renesas@...il.com>
> Cc: Alexey Firago <alexey_firago@...tor.com>
> Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> Cc: linux-renesas-soc@...r.kernel.org
> Signed-off-by: Stephen Boyd <sboyd@...nel.org>
> ---
>  drivers/clk/clk-versaclock5.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-versaclock5.c b/drivers/clk/clk-versaclock5.c
> index 5b393e711e94..026f76276933 100644
> --- a/drivers/clk/clk-versaclock5.c
> +++ b/drivers/clk/clk-versaclock5.c
> @@ -246,7 +246,7 @@ static int vc5_mux_set_parent(struct clk_hw *hw, u8 index)
>  	struct vc5_driver_data *vc5 =
>  		container_of(hw, struct vc5_driver_data, clk_mux);
>  	const u8 mask = VC5_PRIM_SRC_SHDN_EN_XTAL | VC5_PRIM_SRC_SHDN_EN_CLKIN;
> -	u8 src;
> +	u8 src = 0;
>  
>  	if ((index > 1) || !vc5->clk_mux_ins)
>  		return -EINVAL;

Can you rather change the else { } branch in that function such that it does

 if (vc5->clk_mux)ins == ...)
  ...
 else if (...)
  ...
+ else
+  return -EINVAL;

The last bit would assure the function would fail in case the
clk_mux_ins == 0, which can happen if someone builds a setup without any
clock into connected to the VC5 (which would not work hardware-vise).

-- 
Best regards,
Marek Vasut

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ