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]
Date:   Tue, 29 Sep 2020 11:01:07 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Jing Xiangfeng <jingxiangfeng@...wei.com>
Cc:     mchehab+huawei@...nel.org, gregkh@...uxfoundation.org,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: mfd: hi6421-spmi-pmic: Fix error return in
 hi6421_spmi_pmic_probe()

On Tue, Sep 29, 2020 at 03:48:47PM +0800, Jing Xiangfeng wrote:
> Fix to return error code -ENOMEM from the error handling case instead
> of 0.
> 
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@...wei.com>
> ---
>  drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> index 64b30d263c8d..4f34a5282970 100644
> --- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> +++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
> @@ -262,8 +262,10 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)
>  	hi6421_spmi_pmic_irq_prc(pmic);
>  
>  	pmic->irqs = devm_kzalloc(dev, HISI_IRQ_NUM * sizeof(int), GFP_KERNEL);
> -	if (!pmic->irqs)
> +	if (!pmic->irqs) {
> +		ret = -ENOMEM;
>  		goto irq_malloc;

It shouldn't do a goto, it should just return directly.  The goto
releases an IRQ which isn't acquired until later in the function.

regards,
dan carpenter

Powered by blists - more mailing lists