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:   Fri, 2 Jun 2023 17:53:51 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>, Dhruva Gole <d-gole@...com>,
        Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        John Ogness <john.ogness@...utronix.de>,
        Johan Hovold <johan@...nel.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-omap@...r.kernel.org, linux-serial@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/1] serial: core: Fix error handling for
 serial_core_ctrl_device_add()

On Fri, Jun 02, 2023 at 10:00:05AM +0300, Tony Lindgren wrote:
> Checking for NULL is incorrect as serial_base_ctrl_add() uses ERR_PTR().
> 
> Let's also pass any returned error along, there's no reason to translate
> all errors to -ENODEV.

Jiri already asked the same question I have had on a glance, and this all
solved here, so
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> Fixes: 84a9582fd203 ("serial: core: Start managing serial controllers to enable runtime PM")
> Signed-off-by: Tony Lindgren <tony@...mide.com>
> ---
> 
> Changes since v1:
> 
> - Stop translating all errors to -ENODEV
> 
> - There's no need to use IS_ERR_OR_NULL() as noted by Jiri
> 
> ---
>  drivers/tty/serial/serial_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -3342,8 +3342,8 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
>  	ctrl_dev = serial_core_ctrl_find(drv, port->dev, port->ctrl_id);
>  	if (!ctrl_dev) {
>  		new_ctrl_dev = serial_core_ctrl_device_add(port);
> -		if (!new_ctrl_dev) {
> -			ret = -ENODEV;
> +		if (IS_ERR(new_ctrl_dev)) {
> +			ret = PTR_ERR(new_ctrl_dev);
>  			goto err_unlock;
>  		}
>  		ctrl_dev = new_ctrl_dev;
> -- 
> 2.41.0

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ