Message ID | 1430320727-14582-1-git-send-email-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show |
Steven Rostedt <rostedt@goodmis.org> writes: > On Wed, 29 Apr 2015 16:18:46 +0100 > Alex Bennée <alex.bennee@linaro.org> 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> > > Thanks, I'll add a stable tag to this too, and get it out soon. I take it you'll pick up Dave's reviewed-by? As for CC'ing stable I wouldn't worry too much as nothing in the kernel uses __print_array yet (unless you count the example). But it is a fairly trivial patch so if you as the maintainer is happy I'm happy ;-) > > -- Steve > >> >> --- >> 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, '{');
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> --- 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(-)