瀏覽代碼

tracing: Make ftrace_print_array_seq compute buf_len

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.

Link: http://lkml.kernel.org/r/1430320727-14582-1-git-send-email-alex.bennee@linaro.org

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Alex Bennée 10 年之前
父節點
當前提交
ac01ce1410
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 1 1
      include/linux/ftrace_event.h
  2. 2 1
      kernel/trace/trace_output.c

+ 1 - 1
include/linux/ftrace_event.h

@@ -46,7 +46,7 @@ const char *ftrace_print_hex_seq(struct trace_seq *p,
 				 const unsigned char *buf, int len);
 				 const unsigned char *buf, int len);
 
 
 const char *ftrace_print_array_seq(struct trace_seq *p,
 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);
 				   size_t el_size);
 
 
 struct trace_iterator;
 struct trace_iterator;

+ 2 - 1
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);
 EXPORT_SYMBOL(ftrace_print_hex_seq);
 
 
 const char *
 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)
 		       size_t el_size)
 {
 {
 	const char *ret = trace_seq_buffer_ptr(p);
 	const char *ret = trace_seq_buffer_ptr(p);
 	const char *prefix = "";
 	const char *prefix = "";
 	void *ptr = (void *)buf;
 	void *ptr = (void *)buf;
+	size_t buf_len = count * el_size;
 
 
 	trace_seq_putc(p, '{');
 	trace_seq_putc(p, '{');