Commit 44e92f83 authored by Tzvetomir Stoyanov's avatar Tzvetomir Stoyanov Committed by Arnaldo Carvalho de Melo

tools lib traceevent: Add sanity check to is_timestamp_in_us()

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: default avatarSlavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: default avatarTzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20181128145552.68c4f87b@gandalf.local.homeSigned-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a1c8cf29
......@@ -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")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment