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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e6315e6b-78a6-0a8b-c693-9797a4519bd4@kernel.org>
Date:   Tue, 11 Jan 2022 08:08:58 +0100
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Sherry Sun <sherry.sun@....com>, gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-imx@....com
Subject: Re: [PATCH] tty: serial: fsl_lpuart: count tty buffer overruns

On 11. 01. 22, 7:10, Sherry Sun wrote:
> Added support for counting the tty buffer overruns in fsl_lpuart driver
> like other uart drivers.
> 
> Signed-off-by: Sherry Sun <sherry.sun@....com>
> ---
>   drivers/tty/serial/fsl_lpuart.c | 19 +++++++++++++------
>   1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
> index ce3e26144689..1e6f924d8507 100644
> --- a/drivers/tty/serial/fsl_lpuart.c
> +++ b/drivers/tty/serial/fsl_lpuart.c
...
> @@ -1117,6 +1119,7 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport)
>   	struct circ_buf *ring = &sport->rx_ring;
>   	unsigned long flags;
>   	int count = 0;
> +	unsigned int copied = 0;
>   
>   	if (lpuart_is_32(sport)) {
>   		unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
> @@ -1218,20 +1221,24 @@ static void lpuart_copy_rx_to_tty(struct lpuart_port *sport)
>   	if (ring->head < ring->tail) {
>   		count = sport->rx_sgl.length - ring->tail;
>   
> -		tty_insert_flip_string(port, ring->buf + ring->tail, count);
> +		copied = tty_insert_flip_string(port, ring->buf + ring->tail, count);
> +		if (copied != count)

Overall looks good, except tty_insert_flip_string returns an int and 
count is also an int. Wouldn't it be more consistent to declare copied 
as int too? This comparison would be without implicit conversion then.

thanks,
-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ