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: <37e31d03-eee6-7052-fe32-1f37f1b460e1@kernel.org>
Date:   Thu, 3 Feb 2022 09:36:55 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] tty: Drop duplicate NULL check in TTY port
 functions

On 02. 02. 22, 17:57, Andy Shevchenko wrote:
> The free_page(addr), which becomes free_pages(addr, 0) checks addr against 0.
> No need to repeat this check in the callers, i.e.  tty_port_free_xmit_buf()
> and tty_port_destructor().
> 
> Note, INIT_KFIFO() is safe without that check, because it's aware of kfifo PTR
> versus embedded kfifo.

Not sure what you mean here ^^^? But it might be one of the morning 
brain parser errors.

Acked-by: Jiri Slaby <jirislaby@...nel.org>

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>   drivers/tty/tty_port.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
> index 4282895ede9e..880608a65773 100644
> --- a/drivers/tty/tty_port.c
> +++ b/drivers/tty/tty_port.c
> @@ -240,11 +240,9 @@ EXPORT_SYMBOL(tty_port_alloc_xmit_buf);
>   void tty_port_free_xmit_buf(struct tty_port *port)
>   {
>   	mutex_lock(&port->buf_mutex);
> -	if (port->xmit_buf != NULL) {
> -		free_page((unsigned long)port->xmit_buf);
> -		port->xmit_buf = NULL;
> -		INIT_KFIFO(port->xmit_fifo);
> -	}
> +	free_page((unsigned long)port->xmit_buf);
> +	port->xmit_buf = NULL;
> +	INIT_KFIFO(port->xmit_fifo);
>   	mutex_unlock(&port->buf_mutex);
>   }
>   EXPORT_SYMBOL(tty_port_free_xmit_buf);
> @@ -271,8 +269,7 @@ static void tty_port_destructor(struct kref *kref)
>   	/* check if last port ref was dropped before tty release */
>   	if (WARN_ON(port->itty))
>   		return;
> -	if (port->xmit_buf)
> -		free_page((unsigned long)port->xmit_buf);
> +	free_page((unsigned long)port->xmit_buf);
>   	tty_port_destroy(port);
>   	if (port->ops && port->ops->destruct)
>   		port->ops->destruct(port);


-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ