lkml.org 
[lkml]   [2015]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tracing: make ftrace_print_array_seq compute buf_len
Date
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 <alex.bennee@linaro.org>
---
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


\
 
 \ /
  Last update: 2015-04-27 14:41    [W:0.037 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site