linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH 1/5] trace-cmd: Move extract trace_clock into trace-input.c
Date: Fri, 20 Sep 2019 11:02:52 -0400	[thread overview]
Message-ID: <20190920110252.3224e22a@gandalf.local.home> (raw)
In-Reply-To: <CACqStofGsn5mTaT=+K1VSxPeHcfow5NHk3Jo54QBiwYA=79uAQ@mail.gmail.com>

On Fri, 20 Sep 2019 14:55:21 +0000
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:


> >
> > +static void extract_trace_clock(struct tracecmd_input *handle, char *line)
> > +{
> > +       char *data;
> > +       char *clock;  
> 
> I would recommend to initialize clock with NULL, so in case sscanf fails due to
> broken line or mem alloc, handle->trace_clock will not point to random memory.

Good catch! Thanks, I'll update.

-- Steve

> 
> > +       char *next = NULL;
> > +
> > +       data = strtok_r(line, "[]", &next);
> > +       sscanf(data, "%ms", &clock);
> > +       /* TODO: report if it fails to allocate */
> > +       handle->trace_clock = clock;
> > +}
> > +

  reply	other threads:[~2019-09-20 15:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  2:03 [PATCH 0/5] trace-cmd: Update for the new trace_print_event() logic Steven Rostedt
2019-09-18  2:03 ` [PATCH 1/5] trace-cmd: Move extract trace_clock into trace-input.c Steven Rostedt
2019-09-20 14:55   ` Tzvetomir Stoyanov
2019-09-20 15:02     ` Steven Rostedt [this message]
2019-09-20 15:10     ` [PATCH 1/5 v2] " Steven Rostedt
2019-09-20 16:08       ` Tzvetomir Stoyanov
2019-09-20 16:11         ` Steven Rostedt
2019-09-18  2:03 ` [PATCH 2/5] trace-cmd: Separate out time diff code in trace_show_data() Steven Rostedt
2019-09-20 15:08   ` Tzvetomir Stoyanov
2019-09-18  2:03 ` [PATCH 3/5] trace-cmd: Add check for trace_clock using usecs into tracecmd_parse_trace_clock() Steven Rostedt
2019-09-20 15:10   ` Tzvetomir Stoyanov
2019-09-18  2:03 ` [PATCH 4/5] libtraceevent, perf tools: Changes in tep_print_event_* APIs Steven Rostedt
2019-09-19 22:50   ` Steven Rostedt
2019-09-19 22:53     ` [PATCH 4/5 v2] " Steven Rostedt
2019-09-20 16:06     ` [PATCH 4/5] " Tzvetomir Stoyanov
2019-09-19 22:52   ` Steven Rostedt
2019-09-18  2:03 ` [PATCH 5/5] tools/lib/traceevent: Round up in tep_print_event() time precision Steven Rostedt
2019-09-20 15:18   ` Tzvetomir Stoyanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190920110252.3224e22a@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tstoyanov@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).