tracing: Let filter_assign_type() detect FILTER_PTR_STRING
authorCong Wang <xiyou.wangcong@gmail.com>
Sat, 25 May 2019 16:58:00 +0000 (09:58 -0700)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 16 Jul 2019 19:14:48 +0000 (15:14 -0400)
filter_assign_type() could detect dynamic string and static
string, but not string pointers. Teach filter_assign_type()
to detect string pointers, and this will be needed by trace
event injection code.

BTW, trace event hist uses FILTER_PTR_STRING too.
Link: http://lkml.kernel.org/r/20190525165802.25944-3-xiyou.wangcong@gmail.com
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_filter.c

index d3e59312ef405072e941464d5f66a8ef79433750..550e8a0d048ab2e79a3619abbd80b97c58a7448b 100644 (file)
@@ -1080,6 +1080,9 @@ int filter_assign_type(const char *type)
        if (strchr(type, '[') && strstr(type, "char"))
                return FILTER_STATIC_STRING;
 
+       if (strcmp(type, "char *") == 0 || strcmp(type, "const char *") == 0)
+               return FILTER_PTR_STRING;
+
        return FILTER_OTHER;
 }