ftrace: Create ftrace_hash_empty() helper routine
commit06a51d9307380c78bb5c92e68fc80ad2c7d7f890
authorSteven Rostedt <srostedt@redhat.com>
Tue, 20 Dec 2011 00:07:36 +0000 (19 19:07 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 21 Dec 2011 12:23:11 +0000 (21 07:23 -0500)
treee0f38e8780f92937e8f19f17b8bf9eff6bcc3137
parentc842e975520f8ab09e293cc92f51a1f396251fd5
ftrace: Create ftrace_hash_empty() helper routine

There are two types of hashes in the ftrace_ops; one type
is the filter_hash and the other is the notrace_hash. Either
one may be null, meaning it has no elements. But when elements
are added, the hash is allocated.

Throughout the code, a check needs to be made to see if a hash
exists or the hash has elements, but the check if the hash exists
is usually missing causing the possible "NULL pointer dereference bug".

Add a helper routine called "ftrace_hash_empty()" that returns
true if the hash doesn't exist or its count is zero. As they mean
the same thing.

Last-bug-reported-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c