mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Tom Zanussi <zanussi@kernel.org>
Cc: axelrasmussen@google.com, mhiramat@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/3] tracing: Add dynamic strings for synthetic events
Date: Fri, 2 Oct 2020 21:00:36 -0400	[thread overview]
Message-ID: <20201002210036.0200371b@oasis.local.home> (raw)
In-Reply-To: <cover.1601588066.git.zanussi@kernel.org>

On Thu,  1 Oct 2020 16:46:43 -0500
Tom Zanussi <zanussi@kernel.org> wrote:

> Hi,
> 
> This is v3 of the dynamic string support for synthetic events.
> 
> No code changes since v2, just added Fixes: tag for 'tracing: Fix
> parse_synth_field() error handling' as suggested by Masami along with
> his Reviewed-by, and Axel's Tested-bys.
> 

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.

-- Steve

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 4b3ec570147a..d81739990a53 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);

      parent reply	other threads:[~2020-10-03  1:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 21:46 Tom Zanussi
2020-10-01 21:46 ` [PATCH v3 1/3] tracing: Change STR_VAR_MAX_LEN Tom Zanussi
2020-10-02 19:44   ` Steven Rostedt
2020-10-02 22:04     ` Tom Zanussi
2020-10-01 21:46 ` [PATCH v3 2/3] tracing: Fix parse_synth_field() error handling Tom Zanussi
2020-10-01 21:46 ` [PATCH v3 3/3] tracing: Add support for dynamic strings to synthetic events Tom Zanussi
2020-10-03  0:55 ` [PATCH v3 0/3] tracing: Add dynamic strings for " Steven Rostedt
2020-10-03  1:00 ` Steven Rostedt [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=20201002210036.0200371b@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=axelrasmussen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=zanussi@kernel.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®