Skip to contentSkip to conversation

tracing: Fix minor bugs for __unregister_ftrace_function_probe

PATCH In review Atsushi Tsuji 2 participants 3 messages Sep 15, 2009 – Sep 17, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 tracing: Fix minor bugs for __unregister_ftrace_function_probe

Fix the condition of strcmp for "*".
Also fix NULL pointer dereference when glob is NULL.

---
 kernel/trace/ftrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index 8c804e2..5ef8f59 100644
@@ -2059,9 +2059,9 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
 	int i, len = 0;
 	char *search;
 
-	if (glob && (strcmp(glob, "*") || !strlen(glob)))
+	if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))
 		glob = NULL;
-	else {
+	else if (glob) {
 		int not;
 
 		type = ftrace_setup_glob(glob, strlen(glob), &search, &not);
Signature · 1 line
1.5.5.1
maintainer
#1 lore raw
Quoted 4 lines · Atsushi Tsuji

Fix the condition of strcmp for "*".
Also fix NULL pointer dereference when glob is NULL.

This is a real fix, I'll pull it in separately.

Thanks!

-- Steve

Quoted 20 lines
---
 kernel/trace/ftrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index 8c804e2..5ef8f59 100644
@@ -2059,9 +2059,9 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
 	int i, len = 0;
 	char *search;
 
-	if (glob && (strcmp(glob, "*") || !strlen(glob)))
+	if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))
 		glob = NULL;
-	else {
+	else if (glob) {
 		int not;
 
 		type = ftrace_setup_glob(glob, strlen(glob), &search, &not);
#2 lore raw
In reply to Atsushi Tsuji
Commit-ID:  b36461da2a0389149d7f88f3cbc05a30d1db9faa
Gitweb:     http://git.kernel.org/tip/b36461da2a0389149d7f88f3cbc05a30d1db9faa
Author:     Atsushi Tsuji <[email protected]>
AuthorDate: Tue, 15 Sep 2009 19:06:30 +0900
Committer:  Steven Rostedt <[email protected]>
CommitDate: Wed, 16 Sep 2009 09:08:54 -0400

tracing: Fix minor bugs for __unregister_ftrace_function_probe

Fix the condition of strcmp for "*".
Also fix NULL pointer dereference when glob is NULL.

LKML-Reference: <[email protected]>

---
 kernel/trace/ftrace.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ftrace.c +2 -2
index 8b23d56..f7ab7fc 100644
@@ -2062,9 +2062,9 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
 	int i, len = 0;
 	char *search;
 
-	if (glob && (strcmp(glob, "*") || !strlen(glob)))
+	if (glob && (strcmp(glob, "*") == 0 || !strlen(glob)))
 		glob = NULL;
-	else {
+	else if (glob) {
 		int not;
 
 		type = ftrace_setup_glob(glob, strlen(glob), &search, &not);