[PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds a sanity check of is_timestamp_in_us() input
parameter trace_clock. It avoids a potential segfailt in this
function in case trace_clock is NULL.

Signed-off-by: Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx>
---
 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 854b68ef2e4e..12449c308853 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5454,7 +5454,7 @@ void tep_event_info(struct trace_seq *s, struct tep_event *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





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux