From: Dave P Martin <Dave.Martin@arm.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: "rostedt@goodmis.org" <rostedt@goodmis.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Oleg Nesterov <oleg@redhat.com>,
Javi Merino <Javi.Merino@arm.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>
Subject: Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
Date: Wed, 29 Apr 2015 16:52:49 +0100 [thread overview]
Message-ID: <20150429155245.GH3580@e103592.cambridge.arm.com> (raw)
In-Reply-To: <1430320727-14582-1-git-send-email-alex.bennee@linaro.org>
On Wed, Apr 29, 2015 at 04:18:46PM +0100, Alex Bennée wrote:
> The only caller to this function (__print_array) was getting it wrong by
> passing the array length instead of buffer length. As the element size
> was already being passed for other reasons it seems reasonable to push
> the calculation of buffer length into the function.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
That looks better, thanks.
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
>
> ---
> v2:
> - more explicit commit message
> - rename len -> count to reduce ambiguity
> ---
> include/linux/ftrace_event.h | 2 +-
> kernel/trace/trace_output.c | 3 ++-
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index c674ee8..33a66e6 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -45,7 +45,7 @@ const char *ftrace_print_hex_seq(struct trace_seq *p,
> const unsigned char *buf, int len);
>
> const char *ftrace_print_array_seq(struct trace_seq *p,
> - const void *buf, int buf_len,
> + const void *buf, int count,
> size_t el_size);
>
> struct trace_iterator;
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 692bf71..25a086b 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -178,12 +178,13 @@ ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len)
> EXPORT_SYMBOL(ftrace_print_hex_seq);
>
> const char *
> -ftrace_print_array_seq(struct trace_seq *p, const void *buf, int buf_len,
> +ftrace_print_array_seq(struct trace_seq *p, const void *buf, int count,
> size_t el_size)
> {
> const char *ret = trace_seq_buffer_ptr(p);
> const char *prefix = "";
> void *ptr = (void *)buf;
> + size_t buf_len = count * el_size;
>
> trace_seq_putc(p, '{');
>
> --
> 2.3.5
>
prev parent reply other threads:[~2015-04-29 15:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 15:18 Alex Bennée
2015-04-29 15:36 ` Steven Rostedt
2015-04-29 16:02 ` Alex Bennée
2015-04-29 16:06 ` Steven Rostedt
2015-04-29 16:12 ` Javi Merino
2015-04-29 16:26 ` Steven Rostedt
2015-04-29 15:52 ` Dave P Martin [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=20150429155245.GH3580@e103592.cambridge.arm.com \
--to=dave.martin@arm.com \
--cc=Javi.Merino@arm.com \
--cc=alex.bennee@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=peterz@infradead.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®