From patchwork Wed Nov 28 14:40:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10760025 Return-Path: Received: from mail-eopbgr780043.outbound.protection.outlook.com ([40.107.78.43]:39283 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727979AbeK2Bmo (ORCPT ); Wed, 28 Nov 2018 20:42:44 -0500 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us() Date: Wed, 28 Nov 2018 14:40:49 +0000 Message-ID: <20181128144038.21915-1-tstoyanov@vmware.com> Content-Language: en-US MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org List-ID: 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 --- 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")