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: <74d29e0e-d55e-e983-add1-361f7c4af948@microchip.com>
Date:   Tue, 19 Mar 2019 16:21:43 +0000
From:   <Claudiu.Beznea@...rochip.com>
To:     <harini.katakam@...inx.com>, <Nicolas.Ferre@...rochip.com>,
        <davem@...emloft.net>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <michal.simek@...inx.com>, <harinikatakamlinux@...il.com>
Subject: Re: [RFC PATCH] net: macb: Add null check for PCLK and HCLK



On 19.03.2019 07:54, Harini Katakam wrote:
> Both PCLK and HCLK are "required" clocks according to macb devicetree
> documentation. There is a chance that devm_clk_get doesn't return a
> negative error but just a NULL clock structure instead. In such a case
> the driver proceeds as usual and uses pclk value 0 to calculate MDC
> divisor which is incorrect. Hence fix the same in clock initialization.
> 
> Signed-off-by: Harini Katakam <harini.katakam@...inx.com>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index ad099fd..d12d815 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3370,13 +3370,13 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,
>  		*hclk = devm_clk_get(&pdev->dev, "hclk");
>  	}
>  
> -	if (IS_ERR(*pclk)) {
> +	if (IS_ERR(*pclk) || (*pclk == NULL)) {

You can use IS_ERR_OR_NULL() macro.

>  		err = PTR_ERR(*pclk);
>  		dev_err(&pdev->dev, "failed to get macb_clk (%u)\n", err);
>  		return err;
>  	}
>  
> -	if (IS_ERR(*hclk)) {
> +	if (IS_ERR(*hclk) || (*hclk == NULL)) {

Ditto

>  		err = PTR_ERR(*hclk);
>  		dev_err(&pdev->dev, "failed to get hclk (%u)\n", err);
>  		return err;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ