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: <20201116153702.55e55d6d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Mon, 16 Nov 2020 15:37:02 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Zhang Changzhong <zhangchangzhong@...wei.com>
Cc:     <peppe.cavallaro@...com>, <alexandre.torgue@...com>,
        <joabreu@...opsys.com>, <davem@...emloft.net>,
        <mcoquelin.stm32@...il.com>, <vineetha.g.jaya.kumaran@...el.com>,
        <rusaimi.amira.rusaimi@...el.com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: stmmac: dwmac-intel-plat: fix error return
 code in intel_eth_plat_probe()

On Fri, 13 Nov 2020 14:34:03 +0800 Zhang Changzhong wrote:
> Fix to return a negative error code from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 9efc9b2b04c7 ("net: stmmac: Add dwmac-intel-plat for GBE driver")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> index f61cb99..82b1c7a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c
> @@ -113,8 +113,10 @@ static int intel_eth_plat_probe(struct platform_device *pdev)
>  		/* Enable TX clock */
>  		if (dwmac->data->tx_clk_en) {
>  			dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
> -			if (IS_ERR(dwmac->tx_clk))
> +			if (IS_ERR(dwmac->tx_clk)) {
> +				ret = PTR_ERR(dwmac->tx_clk);
>  				goto err_remove_config_dt;
> +			}
>  
>  			clk_prepare_enable(dwmac->tx_clk);

Someone should take the look at the error handling later in this
function. It's not checking ret from clk_prepare_enable(), and even tho
top half of this function uses goto, the rest suddenly starts doing
direct returns :S


                        clk_prepare_enable(dwmac->tx_clk);                       
                                                                                 

                        /* Check and configure TX clock rate */                  
                        rate = clk_get_rate(dwmac->tx_clk);                      
                        if (dwmac->data->tx_clk_rate &&                          
                            rate != dwmac->data->tx_clk_rate) {                  
                                rate = dwmac->data->tx_clk_rate;                 
                                ret = clk_set_rate(dwmac->tx_clk, rate);         
                                if (ret) {                                       
                                        dev_err(&pdev->dev,                      
                                                "Failed to set tx_clk\n");       
                                        return ret;                              
                                }                                                
                        }                                                        
                }                                                                
                                                                                 
                /* Check and configure PTP ref clock rate */                     
                rate = clk_get_rate(plat_dat->clk_ptp_ref);                      
                if (dwmac->data->ptp_ref_clk_rate &&                             
                    rate != dwmac->data->ptp_ref_clk_rate) {                     
                        rate = dwmac->data->ptp_ref_clk_rate;                    
                        ret = clk_set_rate(plat_dat->clk_ptp_ref, rate);         
                        if (ret) {                                               
                                dev_err(&pdev->dev,                              
                                        "Failed to set clk_ptp_ref\n");          
                                return ret;                                      
                        }                                                        
                }                                                                
        }        

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ