linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 v4 7/7] tracing: Change synthetic event string format to limit printed length
Date: Wed, 07 Oct 2020 09:24:43 -0500	[thread overview]
Message-ID: <7de01ef110454f0fdcfc8422260c9e61424a255e.camel@kernel.org> (raw)
In-Reply-To: <20201005181751.1338afbc@gandalf.local.home>

Hi Steve,

On Mon, 2020-10-05 at 18:17 -0400, Steven Rostedt wrote:
> On Sun,  4 Oct 2020 17:14:09 -0500
> Tom Zanussi <zanussi@kernel.org> wrote:
> 
> > From: Steven Rostedt <rostedt@goodmis.org>
> > 
> > Change the format for printing synthetic field strings to limit the
> > length of the string printed even if it's not correctly terminated.
> > 
> > Description from Steve:
> > 
> > I also added this for a bit of paranoid, and probably should be a
> > separate patch, just to make sure if the string isn't nul
> > terminated,
> > this will keep it from bleeding pass the end of the string.
> 
> Just FYI. In the future, for something like this, you should still
> have
> your own Signed-off-by, as you are sending it (and part of the commit
> path). You could also add:
> 
> [ Need signed-off-by from Steven ]
> 
> Which I would have also added as well.
> 

Yeah, will do that next time.  Thanks for the tip.

Tom

> Thanks!
> 
> -- Steve
> 
> 
> > ---
> >  kernel/trace/trace_events_synth.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/trace/trace_events_synth.c
> > b/kernel/trace/trace_events_synth.c
> > index 24bc6d61aa40..742ce5f62d6d 100644
> > --- a/kernel/trace/trace_events_synth.c
> > +++ b/kernel/trace/trace_events_synth.c
> > @@ -234,7 +234,7 @@ static const char *synth_field_fmt(char *type)
> >  	else if (strcmp(type, "gfp_t") == 0)
> >  		fmt = "%x";
> >  	else if (synth_field_is_string(type))
> > -		fmt = "%s";
> > +		fmt = "%.*s";
> >  
> >  	return fmt;
> >  }
> > @@ -303,11 +303,13 @@ static enum print_line_t
> > print_synth_event(struct trace_iterator *iter,
> >  				str_field = (char *)entry +
> > data_offset;
> >  
> >  				trace_seq_printf(s, print_fmt, se-
> > >fields[i]->name,
> > +						 STR_VAR_LEN_MAX,
> >  						 str_field,
> >  						 i == se->n_fields - 1
> > ? "" : " ");
> >  				n_u64++;
> >  			} else {
> >  				trace_seq_printf(s, print_fmt, se-
> > >fields[i]->name,
> > +						 STR_VAR_LEN_MAX,
> >  						 (char *)&entry-
> > >fields[n_u64],
> >  						 i == se->n_fields - 1
> > ? "" : " ");
> >  				n_u64 += STR_VAR_LEN_MAX / sizeof(u64);
> 
> 


      reply	other threads:[~2020-10-07 14:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 22:14 [PATCH v4 0/7] tracing: Add dynamic strings for synthetic events Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 1/7] tracing: Change STR_VAR_MAX_LEN Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 2/7] tracing: Fix parse_synth_field() error handling Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 3/7] tracing: Save normal string variables Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 4/7] tracing: Add support for dynamic strings to synthetic events Tom Zanussi
2020-10-08  9:22   ` Masami Hiramatsu
2020-10-08 19:21     ` Steven Rostedt
2020-10-09 11:15       ` Masami Hiramatsu
2020-10-08 20:33     ` Tom Zanussi
2020-10-04 22:14 ` [PATCH v4 5/7] tracing: Add README information for synthetic_events file Tom Zanussi
2020-10-08  0:38   ` Masami Hiramatsu
2020-10-04 22:14 ` [PATCH v4 6/7] selftests/ftrace: Add test case for synthetic event dynamic strings Tom Zanussi
2020-10-08  0:21   ` Masami Hiramatsu
2020-10-04 22:14 ` [PATCH v4 7/7] tracing: Change synthetic event string format to limit printed length Tom Zanussi
2020-10-05 22:17   ` Steven Rostedt
2020-10-07 14:24     ` Tom Zanussi [this message]

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=7de01ef110454f0fdcfc8422260c9e61424a255e.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;
as well as URLs for NNTP newsgroup(s).