From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-serial@vger.kernel.org,
"Greg KH" <gregkh@linuxfoundation.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Shubhrajyoti Datta" <shubhrajyoti.datta@gmail.com>,
"Srinivas Kandagatla" <srinivas.kandagatla@st.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/9] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7
Date: Fri, 20 May 2022 08:19:36 +0200 [thread overview]
Message-ID: <6f3de705-7db5-584c-1b3a-3ff7fb5c9096@foss.st.com> (raw)
In-Reply-To: <20220519081808.3776-8-ilpo.jarvinen@linux.intel.com>
Hi Ilpo
On 5/19/22 10:18, Ilpo Järvinen wrote:
> Only CS7 and CS8 seem supported but CSIZE is not sanitized from CS5 or
> CS6 to CS8. In addition, ASC_CTL_MODE_7BIT_PAR suggests that CS7 has
> to have parity, thus add PARENB.
>
> Incorrect CSIZE 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().
>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> Fixes: c4b058560762 (serial:st-asc: Add ST ASC driver.)
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/serial/st-asc.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
> index d7fd692286cf..1b0da603ab54 100644
> --- a/drivers/tty/serial/st-asc.c
> +++ b/drivers/tty/serial/st-asc.c
> @@ -535,10 +535,14 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
> /* set character length */
> if ((cflag & CSIZE) == CS7) {
> ctrl_val |= ASC_CTL_MODE_7BIT_PAR;
> + cflag |= PARENB;
> } else {
> ctrl_val |= (cflag & PARENB) ? ASC_CTL_MODE_8BIT_PAR :
> ASC_CTL_MODE_8BIT;
> + cflag &= ~CSIZE;
> + cflag |= CS8;
> }
> + termios->c_cflag = cflag;
>
> /* set stop bit */
> ctrl_val |= (cflag & CSTOPB) ? ASC_CTL_STOP_2BIT : ASC_CTL_STOP_1BIT;
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
next prev parent reply other threads:[~2022-05-20 6:20 UTC|newest]
Thread overview: 11+ 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 ` [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 ` [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 ` [PATCH v2 7/9] serial: st-asc: Sanitize CSIZE and correct PARENB for CS7 Ilpo Järvinen
2022-05-20 6:19 ` Patrice CHOTARD [this message]
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 ` [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=6f3de705-7db5-584c-1b3a-3ff7fb5c9096@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--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 \
--cc=srinivas.kandagatla@st.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).