All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-serial@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Shubhrajyoti Datta <shubhrajyoti.datta@gmail.com>,
	Baruch Siach <baruch@tkos.co.il>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v2 2/9] serial: digicolor-usart: Don't allow CS5-6
Date: Thu, 19 May 2022 11:18:01 +0300	[thread overview]
Message-ID: <20220519081808.3776-3-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20220519081808.3776-1-ilpo.jarvinen@linux.intel.com>

Only CS7 and CS8 seem supported but CSIZE is not sanitized to CS8 in
the default: block.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: 5930cb3511df (serial: driver for Conexant Digicolor USART)
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/digicolor-usart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index 6d70fea76bb3..65e653eb5026 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -309,6 +309,8 @@ static void digicolor_uart_set_termios(struct uart_port *port,
 	case CS8:
 	default:
 		config |= UA_CONFIG_CHAR_LEN;
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
 		break;
 	}
 
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-serial@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Shubhrajyoti Datta <shubhrajyoti.datta@gmail.com>,
	Baruch Siach <baruch@tkos.co.il>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v2 2/9] serial: digicolor-usart: Don't allow CS5-6
Date: Thu, 19 May 2022 11:18:01 +0300	[thread overview]
Message-ID: <20220519081808.3776-3-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20220519081808.3776-1-ilpo.jarvinen@linux.intel.com>

Only CS7 and CS8 seem supported but CSIZE is not sanitized to CS8 in
the default: block.

Set CSIZE correctly so that userspace knows the effective value.
Incorrect CSIZE also results in miscalculation of the frame bits in
tty_get_char_size() or in its predecessor where the roughly the same
code is directly within uart_update_timeout().

Fixes: 5930cb3511df (serial: driver for Conexant Digicolor USART)
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/tty/serial/digicolor-usart.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index 6d70fea76bb3..65e653eb5026 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -309,6 +309,8 @@ static void digicolor_uart_set_termios(struct uart_port *port,
 	case CS8:
 	default:
 		config |= UA_CONFIG_CHAR_LEN;
+		termios->c_cflag &= ~CSIZE;
+		termios->c_cflag |= CS8;
 		break;
 	}
 
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-05-19  8:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19  8:17 [PATCH v2 0/9] tty/serial: Termios flag fixes Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 1/9] serial: uartlite: Fix BRKINT clearing Ilpo Järvinen
2022-05-19  8:18 ` Ilpo Järvinen [this message]
2022-05-19  8:18   ` [PATCH v2 2/9] serial: digicolor-usart: Don't allow CS5-6 Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 3/9] serial: rda-uart: " Ilpo Järvinen
2022-05-19  8:18   ` Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 4/9] serial: txx9: " Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 5/9] serial: sh-sci: " Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 6/9] serial: sifive: Sanitize CSIZE and c_iflag Ilpo Järvinen
2022-05-19  8:18   ` Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 7/9] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 Ilpo Järvinen
2022-05-19  8:18   ` Ilpo Järvinen
2022-05-20  6:19   ` Patrice CHOTARD
2022-05-20  6:19     ` Patrice CHOTARD
2022-05-19  8:18 ` [PATCH v2 8/9] serial: stm32-usart: Correct CSIZE, bits, and parity Ilpo Järvinen
2022-05-19  8:18   ` Ilpo Järvinen
2022-05-19  8:18 ` [PATCH v2 9/9] pcmcia: synclink_cs: Don't allow CS5-6 Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220519081808.3776-3-ilpo.jarvinen@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=baruch@tkos.co.il \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shubhrajyoti.datta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.