Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031318AbbD2Pwz (ORCPT ); Wed, 29 Apr 2015 11:52:55 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:17509 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753563AbbD2Pww convert rfc822-to-8bit (ORCPT ); Wed, 29 Apr 2015 11:52:52 -0400 Date: Wed, 29 Apr 2015 16:52:49 +0100 From: Dave P Martin To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: "rostedt@goodmis.org" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , Oleg Nesterov , Javi Merino , "Peter Zijlstra (Intel)" Subject: Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len Message-ID: <20150429155245.GH3580@e103592.cambridge.arm.com> References: <1430320727-14582-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 In-Reply-To: <1430320727-14582-1-git-send-email-alex.bennee@linaro.org> user-agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 29 Apr 2015 15:52:49.0226 (UTC) FILETIME=[8AFB9AA0:01D08294] X-MC-Unique: -DBV2uJdRFaOZduWXKlGoQ-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2172 Lines: 63 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 That looks better, thanks. Reviewed-by: Dave Martin > > --- > 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/