LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH 2/4] trace: let filter_assign_type() detect FILTER_PTR_STRING
Date: Sat, 25 May 2019 09:58:00 -0700	[thread overview]
Message-ID: <20190525165802.25944-3-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <20190525165802.25944-1-xiyou.wangcong@gmail.com>

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.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 kernel/trace/trace_events_filter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index d3e59312ef40..550e8a0d048a 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -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;
 }
 
-- 
2.21.0


  parent reply	other threads:[~2019-05-25 16:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25 16:57 [PATCH 0/4] trace: introduce trace event injection Cong Wang
2019-05-25 16:57 ` [PATCH 1/4] trace: fold type initialization into tracing_generic_entry_update() Cong Wang
2019-05-25 16:58 ` Cong Wang [this message]
2019-05-25 16:58 ` [PATCH 3/4] trace: make trace_get_fields() global Cong Wang
2019-05-25 16:58 ` [PATCH 4/4] trace: introduce trace event injection Cong Wang
2019-07-09 19:51   ` Steven Rostedt
2019-07-11 17:09     ` Cong Wang
2019-05-25 22:37 ` [PATCH 0/4] " Steven Rostedt
2019-05-26 20:12   ` Cong Wang
2019-06-10 21:11   ` Cong Wang
2019-06-11  1:12     ` Steven Rostedt
2019-06-18 16:57       ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190525165802.25944-3-xiyou.wangcong@gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH 2/4] trace: let filter_assign_type() detect FILTER_PTR_STRING' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).