From 635714312e6a515de2e78e74bf8d5b10593a4dbf Mon Sep 17 00:00:00 2001 From: Chuhong Yuan Date: Mon, 29 Jul 2019 23:13:59 +0800 Subject: 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 --- 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; } -- cgit v1.2.3 From d8a050f5a3e8242242df6430d5980c142350e461 Mon Sep 17 00:00:00 2001 From: Nadav Amit Date: Sun, 21 Oct 2018 21:45:48 -0700 Subject: kgdb: fix comment regarding static function The comment that says that module_event() is not static is clearly wrong. Signed-off-by: Nadav Amit Signed-off-by: Daniel Thompson --- kernel/debug/debug_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 5cc608de6883..10f1187b3907 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -787,11 +787,8 @@ out: } /* - * GDB places a breakpoint at this function to know dynamically - * loaded objects. It's not defined static so that only one instance with this - * name exists in the kernel. + * GDB places a breakpoint at this function to know dynamically loaded objects. */ - static int module_event(struct notifier_block *self, unsigned long val, void *data) { -- cgit v1.2.3