Re: [PATCH 04/27] tty: make tty_operations::send_xchar accept u8 char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CC linux-m68k

On Wed, Dec 6, 2023 at 8:37 AM Jiri Slaby (SUSE) <jirislaby@xxxxxxxxxx> wrote:
tty_operations::send_xchar is one of the last users of 'char' type for
characters in the tty layer. Convert it to u8 now.

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@xxxxxxxxxx>

 drivers/tty/amiserial.c          | 2 +-

Reviewed-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -811,7 +811,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
  * This function is used to send a high-priority XON/XOFF character to
  * the device
  */
-static void rs_send_xchar(struct tty_struct *tty, char ch)
+static void rs_send_xchar(struct tty_struct *tty, u8 ch)
 {
        struct serial_state *info = tty->driver_data;
         unsigned long flags;

Looks like this might fix an actual (harmless?) bug, if anyone evers
configures a VSTOP or VSTART character with bit 7 set?

    info->x_char = ch; // x_char is int, hence sign-extended

transmit_chars() does:

    amiga_custom.serdat = info->x_char | 0x100;

which will inadvertently have all high bits sets, including the bit
9, which is only used if PARENB is enabled.  But as it looks like
PARENB handling is broken in amiseral anyway, this doesn't matter
much...

include/linux/tty.h:#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
include/linux/tty.h:#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux