[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190730100535.iv7blrsktbenjfwv@holly.lan>
Date: Tue, 30 Jul 2019 11:05:35 +0100
From: Daniel Thompson <daniel.thompson@...aro.org>
To: Chuhong Yuan <hslester96@...il.com>
Cc: Jason Wessel <jason.wessel@...driver.com>,
kgdb-bugreport@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/12] kdb: Replace strncmp with str_has_prefix
On Mon, Jul 29, 2019 at 11:13:59PM +0800, Chuhong Yuan wrote:
> strncmp(str, const, len) is error-prone.
> We had better use newly introduced
> str_has_prefix() instead of it.
>
> Signed-off-by: Chuhong Yuan <hslester96@...il.com>
Acked-by: Daniel Thompson <daniel.thompson@...aro.org>
> ---
> kernel/debug/kdb/kdb_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> index 9ecfa37c7fbf..4567fe998c30 100644
> --- a/kernel/debug/kdb/kdb_main.c
> +++ b/kernel/debug/kdb/kdb_main.c
> @@ -830,7 +830,7 @@ static void parse_grep(const char *str)
> cp++;
> while (isspace(*cp))
> cp++;
> - if (strncmp(cp, "grep ", 5)) {
> + if (!str_has_prefix(cp, "grep ")) {
> kdb_printf("invalid 'pipe', see grephelp\n");
> return;
> }
> --
> 2.20.1
>
Powered by blists - more mailing lists