Skip to content

Commit

Permalink
tracing/kprobe: Remove unneeded extra strchr() from create_trace_kpro…
Browse files Browse the repository at this point in the history
…be()

By utilizing a temporary variable, we can avoid adding another call to
strchr(). Instead, save the first call to a temp variable, and then use that
variable as the reference to set the event variable.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (VMware) committed Sep 24, 2018
1 parent 6bf4ca7 commit d6b183e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions kernel/trace/trace_kprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,13 @@ static int create_trace_kprobe(int argc, char **argv)
}

if (event) {
if (strchr(event, '/')) {
char *slash;

slash = strchr(event, '/');
if (slash) {
group = event;
event = strchr(group, '/') + 1;
event[-1] = '\0';
event = slash + 1;
slash[0] = '\0';
if (strlen(group) == 0) {
pr_info("Group name is not specified\n");
return -EINVAL;
Expand Down

0 comments on commit d6b183e

Please sign in to comment.