Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20181128145552.68c4f87b@gandalf.local.home
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tzvetomir Stoyanov and committed by
Arnaldo Carvalho de Melo
44e92f83 a1c8cf29

+1 -1
+1 -1
tools/lib/traceevent/event-parse.c
··· 5409 5409 5410 5410 static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock) 5411 5411 { 5412 - if (!use_trace_clock) 5412 + if (!trace_clock || !use_trace_clock) 5413 5413 return true; 5414 5414 5415 5415 if (!strcmp(trace_clock, "local") || !strcmp(trace_clock, "global")