From: Tom Zanussi <zanussi@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: axelrasmussen@google.com, mhiramat@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/7] tracing: Add synthetic event error logging
Date: Mon, 12 Oct 2020 16:59:23 -0500 [thread overview]
Message-ID: <29cb75c8cb92d34e3dd8ea156893760c81d935b4.camel@kernel.org> (raw)
In-Reply-To: <20201012174908.7ca51d0c@oasis.local.home>
Hi Steve,
On Mon, 2020-10-12 at 17:49 -0400, Steven Rostedt wrote:
> On Mon, 12 Oct 2020 17:42:40 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > On Mon, 12 Oct 2020 15:18:06 -0500
> > Tom Zanussi <zanussi@kernel.org> wrote:
> >
> > > +static char last_cmd[MAX_FILTER_STR_VAL];
> > > +
> > > +static int errpos(const char *str)
> > > +{
> > > + return err_pos(last_cmd, str);
> > > +}
> > > +
> > > +static void last_cmd_set(char *str)
> > > +{
> > > + if (!str)
> > > + return;
> > > +
> > > + strncat(last_cmd, str, MAX_FILTER_STR_VAL - 1);
> >
> > If I understand strncat() correctly, it will add 'n' + 1 bytes from
> > str
> > to last_cmd. That is, I think you want:
> >
> > strncat(last_cmd, str, MAX_FILTER_STR_VAL - (strlen(last_cmd) +
> > 1));
> >
>
> Looking at the patch more, it only has one caller to last_cmd_set(),
> and one caller to synth_err_clear().
>
> Why not just clear on set?
Yeah, that would make sense, or just remove the clear and use strncpy
in last_cmd_set() instead.
Tom
>
> -- Steve
>
>
>
> >
> > > +}
> > > +
> > > +static void synth_err(u8 err_type, u8 err_pos)
> > > +{
> > > + tracing_log_err(NULL, "synthetic_events", last_cmd, err_text,
> > > + err_type, err_pos);
> > > +}
> > > +
> > > +static void synth_err_clear(void)
> > > +{
> > > + last_cmd[0] = '\0';
> > > +}
> > > +
>
>
next prev parent reply other threads:[~2020-10-12 21:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 20:18 [PATCH v2 0/7] tracing: Synthetic event dynamic string fixes Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 1/7] tracing: Don't show dynamic string internals in synthetic event description Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 2/7] tracing: Move is_good_name() from trace_probe.h to trace.h Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 3/7] tracing: Check that the synthetic event and field names are legal Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 4/7] tracing: Add synthetic event error logging Tom Zanussi
2020-10-12 21:42 ` Steven Rostedt
2020-10-12 21:49 ` Steven Rostedt
2020-10-12 21:59 ` Tom Zanussi [this message]
2020-10-12 22:04 ` Steven Rostedt
2020-10-12 22:24 ` Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 5/7] selftests/ftrace: Change synthetic event name for inter-event-combined test Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 6/7] tracing: Handle synthetic event array field type checking correctly Tom Zanussi
2020-10-12 22:14 ` Steven Rostedt
2020-10-12 22:24 ` Tom Zanussi
2020-10-12 20:18 ` [PATCH v2 7/7] selftests/ftrace: Add test case for synthetic event syntax errors Tom Zanussi
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=29cb75c8cb92d34e3dd8ea156893760c81d935b4.camel@kernel.org \
--to=zanussi@kernel.org \
--cc=axelrasmussen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/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
all inboxes | Powered by JetHome®