Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932801AbbD0MR0 (ORCPT ); Mon, 27 Apr 2015 08:17:26 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:44118 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932526AbbD0MRY (ORCPT ); Mon, 27 Apr 2015 08:17:24 -0400 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: rostedt@goodmis.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Oleg Nesterov , "Peter Zijlstra (Intel)" , Dave Martin , Petr Mladek Subject: [PATCH] tracing: make ftrace_print_array_seq compute buf_len Date: Mon, 27 Apr 2015 13:17:48 +0100 Message-Id: <1430137069-859-1-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1734 Lines: 50 The only caller to this function was getting it wrong. I favoured pushing the calculation to as close to the need as possible rather than fixing the one caller. Signed-off-by: Alex Bennée --- 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..e6b0262 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 len, size_t el_size); struct trace_iterator; diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 692bf71..a42703d 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 len, size_t el_size) { const char *ret = trace_seq_buffer_ptr(p); const char *prefix = ""; void *ptr = (void *)buf; + size_t buf_len = len * 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/