Hi Chuhong,

On Mon, Aug 5, 2019 at 2:24 PM Chuhong Yuan <hsleste...@gmail.com> wrote:
> strncmp(str, const, len) is error-prone because len
> is easy to have typo.
> The example is the hard-coded len has counting error
> or sizeof(const) forgets - 1.
> So we prefer using newly introduced str_has_prefix()
> to substitute such strncmp to make code better.
>
> Signed-off-by: Chuhong Yuan <hsleste...@gmail.com>

Thanks for your patch!

> --- a/kernel/printk/braille.c
> +++ b/kernel/printk/braille.c
> @@ -11,11 +11,13 @@
>
>  int _braille_console_setup(char **str, char **brl_options)
>  {
> -       if (!strncmp(*str, "brl,", 4)) {
> +       size_t len;
> +
> +       if ((len = str_has_prefix(*str, "brl,"))) {

Please write this as

    len = str_has_prefix(*str, "brl,");
    if (len) {

(everywhere)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

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

Reply via email to