From: Chuhong Yuan Date: Mon, 29 Jul 2019 15:13:59 +0000 (+0800) Subject: kdb: Replace strncmp with str_has_prefix X-Git-Tag: for-linus-2019-09-27~63^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=635714312e6a515de2e78e74bf8d5b10593a4dbf;p=linux-block.git kdb: Replace strncmp with str_has_prefix strncmp(str, const, len) is error-prone. We had better use newly introduced str_has_prefix() instead of it. Signed-off-by: Chuhong Yuan Signed-off-by: Daniel Thompson --- 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; }