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]
Date:   Fri, 22 May 2020 13:24:57 +0200
From:   Michal Simek <michal.simek@...inx.com>
To:     Dejin Zheng <zhengdejin5@...il.com>, michal.simek@...inx.com,
        wsa@...-dreams.de, harinik@...inx.com, soren.brinkmann@...inx.com,
        linux-i2c@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] i2c: cadence: Add an error handling for
 platform_get_irq()

On 20. 05. 20 16:48, Dejin Zheng wrote:
> The driver initialization should be end immediately after found
> the platform_get_irq() function return an error.
> 
> Fixes: df8eb5691c48d3b0 ("i2c: Add driver for Cadence I2C controller")

I wouldn't really consider this as bug. Driver is likely not failing
when irq is not defined. It should just fail later on when
devm_request_irq is called.
Or is there any other issue with it?

> Signed-off-by: Dejin Zheng <zhengdejin5@...il.com>
> ---
> v1 -> v2:
> 	- add Fixes tag.
> 
>  drivers/i2c/busses/i2c-cadence.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index 89d58f7d2a25..0e8debe32cea 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -912,6 +912,8 @@ static int cdns_i2c_probe(struct platform_device *pdev)
>  		return PTR_ERR(id->membase);
>  
>  	id->irq = platform_get_irq(pdev, 0);
> +	if (id->irq < 0)
> +		return id->irq;
>  
>  	id->adap.owner = THIS_MODULE;
>  	id->adap.dev.of_node = pdev->dev.of_node;
> 

The change is valid but the question is if make sense to do it in this
way. Some drivers are using devm_request_irq to do do job.

For example:
 	id->irq = platform_get_irq(pdev, 0);
        ret = devm_request_irq(&pdev->dev, id->irq, cdns_i2c_isr, 0,
                                  DRIVER_NAME, id);
        if (ret)
		return ret;

But I am also fine with solution above where you fail in quickest way.

Without that Fixed tag
Acked-by: Michal Simek <michal.simek@...inx.com>

Thanks,
Michal

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ