Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82f91fe0 authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

tty: Always handle NULL flag ptr



Most line disciplines already handle the undocumented NULL flag
ptr in their .receive_buf method; however, several don't.

Document the NULL flag ptr, and correct handling in the
N_MOUSE, N_GSM0710 and N_R394 line disciplines.

Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6c67716d
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
{
	struct serport *serport = (struct serport*) tty->disc_data;
	unsigned long flags;
	unsigned int ch_flags;
	unsigned int ch_flags = 0;
	int i;

	spin_lock_irqsave(&serport->lock, flags);
@@ -133,6 +133,7 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
		goto out;

	for (i = 0; i < count; i++) {
		if (fp) {
			switch (fp[i]) {
			case TTY_FRAME:
				ch_flags = SERIO_FRAME;
@@ -146,6 +147,7 @@ static void serport_ldisc_receive(struct tty_struct *tty, const unsigned char *c
				ch_flags = 0;
				break;
			}
		}

		serio_interrupt(serport->serio, cp[i], ch_flags);
	}
+3 −2
Original line number Diff line number Diff line
@@ -2269,13 +2269,14 @@ static void gsmld_receive_buf(struct tty_struct *tty, const unsigned char *cp,
	char *f;
	int i;
	char buf[64];
	char flags;
	char flags = TTY_NORMAL;

	if (debug & 4)
		print_hex_dump_bytes("gsmld_receive: ", DUMP_PREFIX_OFFSET,
				     cp, count);

	for (i = count, dp = cp, f = fp; i; i--, dp++) {
		if (f)
			flags = *f++;
		switch (flags) {
		case TTY_NORMAL:
+1 −1
Original line number Diff line number Diff line
@@ -1244,7 +1244,7 @@ static void r3964_receive_buf(struct tty_struct *tty, const unsigned char *cp,
{
	struct r3964_info *pInfo = tty->disc_data;
	const unsigned char *p;
	char *f, flags = 0;
	char *f, flags = TTY_NORMAL;
	int i;

	for (i = count, p = cp, f = fp; i; i--, p++) {
+4 −2
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@
 *	processing.  <cp> is a pointer to the buffer of input
 *	character received by the device.  <fp> is a pointer to a
 *	pointer of flag bytes which indicate whether a character was
 *	received with a parity error, etc.
 *	received with a parity error, etc. <fp> may be NULL to indicate
 *	all data received is TTY_NORMAL.
 *
 * void	(*write_wakeup)(struct tty_struct *);
 *
@@ -118,7 +119,8 @@
 *	processing.  <cp> is a pointer to the buffer of input
 *	character received by the device.  <fp> is a pointer to a
 *	pointer of flag bytes which indicate whether a character was
 *	received with a parity error, etc.
 *	received with a parity error, etc. <fp> may be NULL to indicate
 *	all data received is TTY_NORMAL.
 *	If assigned, prefer this function for automatic flow control.
 */