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: <7cb1cc42-ef98-cbbe-1779-107602747d07@kernel.org>
Date:   Wed, 6 Apr 2022 10:13:36 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        linux-serial@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org,
        Gilles Buloz <gilles.buloz@...tron.com>,
        Johan Hovold <johan@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH 1/2] tty: Add lookahead param to receive_buf

On 05. 04. 22, 12:24, Ilpo Järvinen wrote:
> After lookahead for XON/XOFF characters is added by the next
> patch, the receive side needs to ensure the flow-control
> actions are not retaken later on when those same characters
> get read by TTY.
> 
> Thus, pass lookahead count to receive_buf and skip
> flow-control character actions if already taken for the
> character in question. Lookahead count will become live after
> the next patch.
...
> --- a/include/linux/tty_ldisc.h
> +++ b/include/linux/tty_ldisc.h
> @@ -224,11 +224,11 @@ struct tty_ldisc_ops {
>   	 * The following routines are called from below.
>   	 */
>   	void	(*receive_buf)(struct tty_struct *tty, const unsigned char *cp,
> -			       const char *fp, int count);
> +			       const char *fp, int count, int lookahead_count);
>   	void	(*write_wakeup)(struct tty_struct *tty);
>   	void	(*dcd_change)(struct tty_struct *tty, unsigned int status);
>   	int	(*receive_buf2)(struct tty_struct *tty, const unsigned char *cp,
> -				const char *fp, int count);
> +				const char *fp, int count, int lookahead_count);

Please always use unsigned if you don't expect negative numbers. count 
should be changed to unsigned in long term too.

> diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h
> index 58e9619116b7..1871a6a9cb00 100644
> --- a/include/linux/tty_port.h
> +++ b/include/linux/tty_port.h
> @@ -39,7 +39,7 @@ struct tty_port_operations {
>   };
>   
>   struct tty_port_client_operations {
> -	int (*receive_buf)(struct tty_port *port, const unsigned char *, const unsigned char *, size_t);
> +	int (*receive_buf)(struct tty_port *port, const unsigned char *, const unsigned char *, size_t, size_t);

Good, here it is unsigned and even of size_t size (I don't immediately 
see why, but OK).

thanks,
-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ