All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us()
@ 2018-11-28 14:40 Tzvetomir Stoyanov
  2018-11-28 14:44 ` Steven Rostedt
  2018-11-30 16:27 ` Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Tzvetomir Stoyanov @ 2018-11-28 14:40 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel

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@vmware.com>
---
 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

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

* Re: [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us()
  2018-11-28 14:40 [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us() Tzvetomir Stoyanov
@ 2018-11-28 14:44 ` Steven Rostedt
  2018-11-30 16:27 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-11-28 14:44 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel, Slavomir Kaslev

On Wed, 28 Nov 2018 14:40:49 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> 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@vmware.com>

Thanks Tzvetomir!

I'm going to add a:

 Reported-by: Slavomir Kaslev <kaslevs@vmware.com>

to this patch.

-- Steve

> ---
>  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")

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

* Re: [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us()
  2018-11-28 14:40 [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us() Tzvetomir Stoyanov
  2018-11-28 14:44 ` Steven Rostedt
@ 2018-11-30 16:27 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2018-11-30 16:27 UTC (permalink / raw)
  To: Tzvetomir Stoyanov; +Cc: linux-trace-devel, Slavomir Kaslev

On Wed, 28 Nov 2018 14:40:49 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> 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.

FYI, I applied this to trace-cmd as well.

-- Steve

> 
> Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
> ---
>  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")

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

end of thread, other threads:[~2018-12-01  3:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 14:40 [PATCH] tools/lib/traceevent: Sanity check of is_timestamp_in_us() Tzvetomir Stoyanov
2018-11-28 14:44 ` Steven Rostedt
2018-11-30 16:27 ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.