mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
@ 2015-04-29 15:18 Alex Bennée
  2015-04-29 15:36 ` Steven Rostedt
  2015-04-29 15:52 ` Dave P Martin
  0 siblings, 2 replies; 7+ messages in thread
From: Alex Bennée @ 2015-04-29 15:18 UTC (permalink / raw)
  To: rostedt, mingo, Dave.Martin
  Cc: linux-kernel, Alex Bennée, Oleg Nesterov, Javi Merino,
	Peter Zijlstra (Intel)

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(-)

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 15:18 [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len Alex Bennée
@ 2015-04-29 15:36 ` Steven Rostedt
  2015-04-29 16:02   ` Alex Bennée
  2015-04-29 15:52 ` Dave P Martin
  1 sibling, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2015-04-29 15:36 UTC (permalink / raw)
  To: Alex Bennée
  Cc: mingo, Dave.Martin, linux-kernel, Oleg Nesterov, Javi Merino,
	Peter Zijlstra (Intel)

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.

-- 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(-)
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 15:18 [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len Alex Bennée
  2015-04-29 15:36 ` Steven Rostedt
@ 2015-04-29 15:52 ` Dave P Martin
  1 sibling, 0 replies; 7+ messages in thread
From: Dave P Martin @ 2015-04-29 15:52 UTC (permalink / raw)
  To: Alex Bennée
  Cc: rostedt, mingo, linux-kernel, Oleg Nesterov, Javi Merino,
	Peter Zijlstra (Intel)

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 <alex.bennee@linaro.org>

That looks better, thanks.

Reviewed-by: Dave Martin <Dave.Martin@arm.com>

> 
> ---
> 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
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 15:36 ` Steven Rostedt
@ 2015-04-29 16:02   ` Alex Bennée
  2015-04-29 16:06     ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Bennée @ 2015-04-29 16:02 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, Dave.Martin, linux-kernel, Oleg Nesterov, Javi Merino,
	Peter Zijlstra (Intel)


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(-)
>> 

-- 
Alex Bennée

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 16:02   ` Alex Bennée
@ 2015-04-29 16:06     ` Steven Rostedt
  2015-04-29 16:12       ` Javi Merino
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2015-04-29 16:06 UTC (permalink / raw)
  To: Alex Bennée
  Cc: mingo, Dave.Martin, linux-kernel, Oleg Nesterov, Javi Merino,
	Peter Zijlstra (Intel)

On Wed, 29 Apr 2015 17:02:50 +0100
Alex Bennée <alex.bennee@linaro.org> wrote:

> 
> 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?

Yep, I will.

> 
> 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 ;-)

OK, if it's not used, then I'll just add it to this release.

Thanks,

-- Steve

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 16:06     ` Steven Rostedt
@ 2015-04-29 16:12       ` Javi Merino
  2015-04-29 16:26         ` Steven Rostedt
  0 siblings, 1 reply; 7+ messages in thread
From: Javi Merino @ 2015-04-29 16:12 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Alex Bennée, mingo, Dave P Martin, linux-kernel,
	Oleg Nesterov, Peter Zijlstra (Intel)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 1500 bytes --]

On Wed, Apr 29, 2015 at 05:06:22PM +0100, Steven Rostedt wrote:
> On Wed, 29 Apr 2015 17:02:50 +0100
> Alex Bennée <alex.bennee@linaro.org> wrote:
> 
> > 
> > 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?
> 
> Yep, I will.
> 
> > 
> > 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 ;-)
> 
> OK, if it's not used, then I'll just add it to this release.

Our maintainer missed the merge window (sigh) so the patches that were
going to use this will have to wait until linux v4.2.  So they will be
users in the future, but there's no need for this to go to stable.

Cheers,
Javi
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len
  2015-04-29 16:12       ` Javi Merino
@ 2015-04-29 16:26         ` Steven Rostedt
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2015-04-29 16:26 UTC (permalink / raw)
  To: Javi Merino
  Cc: Alex Bennée, mingo, Dave P Martin, linux-kernel,
	Oleg Nesterov, Peter Zijlstra (Intel)

On Wed, 29 Apr 2015 17:12:21 +0100
Javi Merino <javi.merino@arm.com> wrote:


> Our maintainer missed the merge window (sigh) so the patches that were
> going to use this will have to wait until linux v4.2.  So they will be
> users in the future, but there's no need for this to go to stable.

I'll still get this in for 4.1, as new code will depend on it.

-- Steve


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-04-29 16:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 15:18 [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len Alex Bennée
2015-04-29 15:36 ` Steven Rostedt
2015-04-29 16:02   ` Alex Bennée
2015-04-29 16:06     ` Steven Rostedt
2015-04-29 16:12       ` Javi Merino
2015-04-29 16:26         ` Steven Rostedt
2015-04-29 15:52 ` Dave P Martin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®