Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1179144

Re: [PATCH 22/42] x86, setup: Check early serial console per string instead of one char

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH 22/42] x86, setup: Check early serial console per string instead of one char
Date 2015-07-08 01:00 +0200
Message-ID <pJK0i-39I-19@gated-at.bofh.it> (permalink)
References <pJHF7-1PR-3@gated-at.bofh.it> <pJHFa-1PR-85@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 7, 2015 at 1:20 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> Move out serial_putchar() calling out of putchar
> Let puts() to call serial_putchar() directly.
>
> So only need to check early_serial_base per string.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>

If you're going to do this, I think putchar should be static, and all
callers should be switched to puts. There are callers that expect
putchar to send to both bios and serial.

-Kees

> ---
>  arch/x86/boot/tty.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c
> index def2451..114caea 100644
> --- a/arch/x86/boot/tty.c
> +++ b/arch/x86/boot/tty.c
> @@ -52,16 +52,22 @@ static void __attribute__((section(".inittext"))) bios_putchar(int ch)
>  void __attribute__((section(".inittext"))) putchar(int ch)
>  {
>         if (ch == '\n')
> -               putchar('\r');  /* \n -> \r\n */
> +               bios_putchar('\r');     /* \n -> \r\n */
>
>         bios_putchar(ch);
> -
> -       if (early_serial_base != 0)
> -               serial_putchar(ch);
>  }
>
>  void __attribute__((section(".inittext"))) puts(const char *str)
>  {
> +       if (early_serial_base) {
> +               const char *s = str;
> +               while (*s) {
> +                       if (*s == '\n')
> +                               serial_putchar('\r');
> +                       serial_putchar(*s++);
> +               }
> +       }
> +
>         while (*str)
>                 putchar(*str++);
>  }
> --
> 1.8.4.5
>



-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 22/42] x86, setup: Check early serial console per string  instead of one char Kees Cook <keescook@chromium.org> - 2015-07-08 01:00 +0200

csiph-web