On Tue, Dec 10, 2024 at 3:16 PM Daniel Thompson <daniel@xxxxxxxxxxxx> wrote: > > On Tue, Dec 10, 2024 at 05:34:47AM -0800, Amal Raj T wrote: > > From: Amal Raj T <amalrajt@xxxxxxxx> > > > > The current implementation of `poll_put_char` in the serial console driver > > performs LF -> CRLF replacement, which can corrupt binary data. Since kdb > > is the only user of `poll_put_char`, this patch moves the LF -> CRLF > > replacement logic to kdb. > > This description only explains why it is safe to change > uart_poll_put_char() but... > > > > > Link: https://lore.kernel.org/linux-debuggers/Zy093jVKPs9gSVx2@telecaster/ > > > > Signed-off-by: Amal Raj T <amalrajt@xxxxxxxx> > > --- > > drivers/tty/serial/serial_core.c | 4 ---- > > kernel/debug/kdb/kdb_io.c | 2 ++ > > 2 files changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > > index 74fa02b23772..ed18492b7f8f 100644 > > --- a/drivers/tty/serial/serial_core.c > > +++ b/drivers/tty/serial/serial_core.c > > @@ -2142,8 +2142,6 @@ void uart_console_write(struct uart_port *port, const char *s, > > unsigned int i; > > > > for (i = 0; i < count; i++, s++) { > > - if (*s == '\n') > > - putchar(port, '\r'); > > putchar(port, *s); > > } > > } > > ... kgdb isn't the only user of uart_console_write() though, right? Yes, the replacement should be only for uart_poll_put_char, fixed this in v2 > > > Daniel.