summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuhong Yuan <hslester96@gmail.com>2019-07-29 11:13:59 -0400
committerDaniel Thompson <daniel.thompson@linaro.org>2019-09-03 06:19:31 -0400
commit635714312e6a515de2e78e74bf8d5b10593a4dbf (patch)
tree0ac32e50cec11cc9a955f5b832b685ccaf323365
parentd1abaeb3be7b5fa6d7a1fbbd2e14e3310005c4c1 (diff)
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 <hslester96@gmail.com> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
-rw-r--r--kernel/debug/kdb/kdb_main.c2
1 files changed, 1 insertions, 1 deletions
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)
830 cp++; 830 cp++;
831 while (isspace(*cp)) 831 while (isspace(*cp))
832 cp++; 832 cp++;
833 if (strncmp(cp, "grep ", 5)) { 833 if (!str_has_prefix(cp, "grep ")) {
834 kdb_printf("invalid 'pipe', see grephelp\n"); 834 kdb_printf("invalid 'pipe', see grephelp\n");
835 return; 835 return;
836 } 836 }