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]
Date:   Thu, 3 Mar 2022 09:12:05 +0100
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Jiri Slaby <jslaby@...e.cz>, gregkh@...uxfoundation.org
Cc:     linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
        Richard Genoud <richard.genoud@...il.com>,
        Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Paul Cercueil <paul@...pouillou.net>,
        Tobias Klauser <tklauser@...tanz.ch>,
        Russell King <linux@...linux.org.uk>,
        Vineet Gupta <vgupta@...nel.org>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        bcm-kernel-feedback-list@...adcom.com,
        Alexander Shiyan <shc_work@...l.ru>,
        Baruch Siach <baruch@...s.co.il>,
        "Maciej W. Rozycki" <macro@...am.me.uk>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Shawn Guo <shawnguo@...nel.org>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Pengutronix Kernel Team <kernel@...gutronix.de>,
        Fabio Estevam <festevam@...il.com>,
        NXP Linux Team <linux-imx@....com>,
        Karol Gugala <kgugala@...micro.com>,
        Mateusz Holenko <mholenko@...micro.com>,
        Vladimir Zapolskiy <vz@...ia.com>,
        Kevin Hilman <khilman@...libre.com>,
        Jerome Brunet <jbrunet@...libre.com>,
        Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
        Taichi Sugaya <sugaya.taichi@...ionext.com>,
        Takao Orito <orito.takao@...ionext.com>,
        Liviu Dudau <liviu.dudau@....com>,
        Sudeep Holla <sudeep.holla@....com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Andreas Färber <afaerber@...e.de>,
        Manivannan Sadhasivam <mani@...nel.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
        Orson Zhai <orsonzhai@...il.com>,
        Baolin Wang <baolin.wang7@...il.com>,
        Chunyan Zhang <zhang.lyra@...il.com>,
        Patrice Chotard <patrice.chotard@...s.st.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        "David S. Miller" <davem@...emloft.net>,
        Peter Korsgaard <peter@...sgaard.com>,
        Michal Simek <michal.simek@...inx.com>
Subject: Re: [PATCH v4] serial: make uart_console_write->putchar()'s character
 an unsigned char

On 03/03/2022 09:08, Jiri Slaby wrote:
> Currently, uart_console_write->putchar's second parameter (the
> character) is of type int. It makes little sense, provided uart_console_write()
> accepts the input string as "const char *s" and passes its content -- the
> characters -- to putchar(). So switch the character's type to unsigned
> char.
> 
> We don't use char as that is signed on some platforms. That would cause
> troubles for drivers which (implicitly) cast the char to u16 when
> writing to the device. Sign extension would happen in that case and the
> value written would be completely different to the provided char. DZ is
> an example of such a driver -- on MIPS, it uses u16 for dz_out in
> dz_console_putchar().
> 
> Note we do the char -> uchar conversion implicitly in
> uart_console_write(). Provided we do not change size of the data type,
> sign extension does not happen there, so the problem is void.
> 
> This makes the types consistent and unified with the rest of the uart
> layer, which uses unsigned char in most places already. One exception is
> xmit_buf, but that is going to be converted later.
> 
> Signed-off-by: Jiri Slaby <jslaby@...e.cz>
> Acked-by: Richard Genoud <richard.genoud@...il.com> [atmel_serial]
> Acked-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> Cc: Paul Cercueil <paul@...pouillou.net>
> Cc: Tobias Klauser <tklauser@...tanz.ch>
> Cc: Russell King <linux@...linux.org.uk>
> Cc: Vineet Gupta <vgupta@...nel.org>
> Cc: Nicolas Ferre <nicolas.ferre@...rochip.com>
> Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>
> Cc: Ludovic Desroches <ludovic.desroches@...rochip.com>
> Cc: Florian Fainelli <f.fainelli@...il.com>
> Cc: bcm-kernel-feedback-list@...adcom.com
> Cc: Alexander Shiyan <shc_work@...l.ru>
> Cc: Baruch Siach <baruch@...s.co.il>
> Cc: "Maciej W. Rozycki" <macro@...am.me.uk>
> Cc: Paul Walmsley <paul.walmsley@...ive.com>
> Cc: Palmer Dabbelt <palmer@...belt.com>
> Cc: Albert Ou <aou@...s.berkeley.edu>
> Cc: Shawn Guo <shawnguo@...nel.org>
> Cc: Sascha Hauer <s.hauer@...gutronix.de>
> Cc: Pengutronix Kernel Team <kernel@...gutronix.de>
> Cc: Fabio Estevam <festevam@...il.com>
> Cc: NXP Linux Team <linux-imx@....com>
> Cc: Karol Gugala <kgugala@...micro.com>
> Cc: Mateusz Holenko <mholenko@...micro.com>
> Cc: Vladimir Zapolskiy <vz@...ia.com>
> Cc: Neil Armstrong <narmstrong@...libre.com>
> Cc: Kevin Hilman <khilman@...libre.com>
> Cc: Jerome Brunet <jbrunet@...libre.com>
> Cc: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
> Cc: Taichi Sugaya <sugaya.taichi@...ionext.com>
> Cc: Takao Orito <orito.takao@...ionext.com>
> Cc: Liviu Dudau <liviu.dudau@....com>
> Cc: Sudeep Holla <sudeep.holla@....com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@....com>
> Cc: "Andreas Färber" <afaerber@...e.de>
> Cc: Manivannan Sadhasivam <mani@...nel.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Andy Gross <agross@...nel.org>
> Cc: Bjorn Andersson <bjorn.andersson@...aro.org>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
> Cc: Orson Zhai <orsonzhai@...il.com>
> Cc: Baolin Wang <baolin.wang7@...il.com>
> Cc: Chunyan Zhang <zhang.lyra@...il.com>
> Cc: Patrice Chotard <patrice.chotard@...s.st.com>
> Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>
> Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Peter Korsgaard <peter@...sgaard.com>
> Cc: Michal Simek <michal.simek@...inx.com>
> ---
> [v2] make it unsigned
> [v3] fix also sunsab
> [v4] fix also sunplus (added quite recently)
> 
>   drivers/tty/goldfish.c                     | 2 +-
>   drivers/tty/hvc/hvc_dcc.c                  | 2 +-
>   drivers/tty/serial/21285.c                 | 2 +-
>   drivers/tty/serial/8250/8250_early.c       | 2 +-
>   drivers/tty/serial/8250/8250_ingenic.c     | 2 +-
>   drivers/tty/serial/8250/8250_port.c        | 2 +-
>   drivers/tty/serial/altera_jtaguart.c       | 4 ++--
>   drivers/tty/serial/altera_uart.c           | 2 +-
>   drivers/tty/serial/amba-pl010.c            | 2 +-
>   drivers/tty/serial/amba-pl011.c            | 6 +++---
>   drivers/tty/serial/apbuart.c               | 2 +-
>   drivers/tty/serial/ar933x_uart.c           | 2 +-
>   drivers/tty/serial/arc_uart.c              | 2 +-
>   drivers/tty/serial/atmel_serial.c          | 2 +-
>   drivers/tty/serial/bcm63xx_uart.c          | 2 +-
>   drivers/tty/serial/clps711x.c              | 2 +-
>   drivers/tty/serial/digicolor-usart.c       | 2 +-
>   drivers/tty/serial/dz.c                    | 2 +-
>   drivers/tty/serial/earlycon-arm-semihost.c | 2 +-
>   drivers/tty/serial/earlycon-riscv-sbi.c    | 2 +-
>   drivers/tty/serial/fsl_linflexuart.c       | 4 ++--
>   drivers/tty/serial/fsl_lpuart.c            | 4 ++--
>   drivers/tty/serial/imx.c                   | 2 +-
>   drivers/tty/serial/imx_earlycon.c          | 2 +-
>   drivers/tty/serial/ip22zilog.c             | 2 +-
>   drivers/tty/serial/lantiq.c                | 2 +-
>   drivers/tty/serial/liteuart.c              | 2 +-
>   drivers/tty/serial/lpc32xx_hs.c            | 2 +-
>   drivers/tty/serial/meson_uart.c            | 2 +-
>   drivers/tty/serial/milbeaut_usio.c         | 2 +-
>   drivers/tty/serial/mps2-uart.c             | 4 ++--
>   drivers/tty/serial/mvebu-uart.c            | 4 ++--
>   drivers/tty/serial/mxs-auart.c             | 2 +-
>   drivers/tty/serial/omap-serial.c           | 4 ++--
>   drivers/tty/serial/owl-uart.c              | 2 +-
>   drivers/tty/serial/pch_uart.c              | 2 +-
>   drivers/tty/serial/pic32_uart.c            | 2 +-
>   drivers/tty/serial/pmac_zilog.c            | 2 +-
>   drivers/tty/serial/pxa.c                   | 2 +-
>   drivers/tty/serial/qcom_geni_serial.c      | 2 +-
>   drivers/tty/serial/rda-uart.c              | 2 +-
>   drivers/tty/serial/sa1100.c                | 2 +-
>   drivers/tty/serial/samsung_tty.c           | 4 ++--
>   drivers/tty/serial/sb1250-duart.c          | 2 +-
>   drivers/tty/serial/sccnxp.c                | 2 +-
>   drivers/tty/serial/serial_core.c           | 2 +-
>   drivers/tty/serial/serial_txx9.c           | 2 +-
>   drivers/tty/serial/sh-sci.c                | 2 +-
>   drivers/tty/serial/sifive.c                | 4 ++--
>   drivers/tty/serial/sprd_serial.c           | 4 ++--
>   drivers/tty/serial/st-asc.c                | 2 +-
>   drivers/tty/serial/stm32-usart.c           | 2 +-
>   drivers/tty/serial/sunplus-uart.c          | 5 +++--
>   drivers/tty/serial/sunsab.c                | 2 +-
>   drivers/tty/serial/sunsu.c                 | 2 +-
>   drivers/tty/serial/sunzilog.c              | 4 ++--
>   drivers/tty/serial/uartlite.c              | 4 ++--
>   drivers/tty/serial/vr41xx_siu.c            | 2 +-
>   drivers/tty/serial/vt8500_serial.c         | 2 +-
>   drivers/tty/serial/xilinx_uartps.c         | 2 +-
>   drivers/tty/serial/zs.c                    | 2 +-
>   include/linux/serial_core.h                | 2 +-
>   62 files changed, 77 insertions(+), 76 deletions(-)
> 

[...]

> --- a/drivers/tty/serial/meson_uart.c
> +++ b/drivers/tty/serial/meson_uart.c
> @@ -516,7 +516,7 @@ static void meson_uart_enable_tx_engine(struct uart_port *port)
>   	writel(val, port->membase + AML_UART_CONTROL);
>   }
>   
> -static void meson_console_putchar(struct uart_port *port, int ch)
> +static void meson_console_putchar(struct uart_port *port, unsigned char ch)
>   {
>   	if (!port->membase)
>   		return;

[...]
Acked-by: Neil Armstrong <narmstrong@...libre.com> # meson_serial

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ