Skip to content

Commit

Permalink
ftrace: Fix ftrace hash record update with notrace
Browse files Browse the repository at this point in the history
commit c842e97 upstream.

When disabling the "notrace" records, that means we want to trace them.
If the notrace_hash is zero, it means that we want to trace all
records. But to disable a zero notrace_hash means nothing.

The check for the notrace_hash count was incorrect with:

	if (hash && !hash->count)
		return

With the correct comment above it that states that we do nothing
if the notrace_hash has zero count. But !hash also means that
the notrace hash has zero count. I think this was done to
protect against dereferencing NULL. But if !hash is true, then
we go through the following loop without doing a single thing.

Fix it to:

	if (!hash || !hash->count)
		return;

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Steven Rostedt authored and Ben Hutchings committed Jan 3, 2014
1 parent f7d537d commit 4f02a39
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ static void __ftrace_hash_rec_update(struct ftrace_ops *ops,
* If the notrace hash has no items,
* then there's nothing to do.
*/
if (hash && !hash->count)
if (!hash || !hash->count)
return;
}

Expand Down

0 comments on commit 4f02a39

Please sign in to comment.