public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/lib/traceevent: Add sanity check to is_timestamp_in_us()
@ 2018-11-28 19:55 Steven Rostedt
  2018-12-14 20:31 ` [tip:perf/core] tools lib traceevent: " tip-bot for Tzvetomir Stoyanov
  2018-12-18 13:58 ` tip-bot for Tzvetomir Stoyanov
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-11-28 19:55 UTC (permalink / raw)
  To: LKML
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar,
	Tzvetomir Stoyanov, Slavomir Kaslev


From: Tzvetomir Stoyanov <tstoyanov@vmware.com>

This patch adds a sanity check to is_timestamp_in_us() input
parameter trace_clock. It avoids a potential segfault in this
function for the case trace_clock is NULL.

Reported-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/lib/traceevent/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 3692f29fee46..c383305510b4 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5409,7 +5409,7 @@ void tep_event_info(struct trace_seq *s, struct tep_event_format *event,
 
 static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock)
 {
-	if (!use_trace_clock)
+	if (!trace_clock || !use_trace_clock)
 		return true;
 
 	if (!strcmp(trace_clock, "local") || !strcmp(trace_clock, "global")
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-18 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-28 19:55 [PATCH] tools/lib/traceevent: Add sanity check to is_timestamp_in_us() Steven Rostedt
2018-12-14 20:31 ` [tip:perf/core] tools lib traceevent: " tip-bot for Tzvetomir Stoyanov
2018-12-18 13:58 ` tip-bot for Tzvetomir Stoyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox