linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Filipe Brandenburger <filbranden@google.com>
Cc: Li Zefan <lizefan@huawei.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] tracing: correctly expand len expressions from __dynamic_array macro
Date: Mon, 3 Mar 2014 14:51:10 -0500	[thread overview]
Message-ID: <20140303145110.0c09709c@gandalf.local.home> (raw)
In-Reply-To: <1393651938-16418-2-git-send-email-filbranden@google.com>

On Fri, 28 Feb 2014 21:32:16 -0800
Filipe Brandenburger <filbranden@google.com> wrote:

> This fixes expansion of the len argument in __dynamic_array macros.
> The previous code from commit 7d536cb3f would not fully evaluate the
> expression before multiplying its result by the size of the type.
> 
> This went unnoticed because the length stored in the high 16 bits of the
> offset (which is the one that was broken here) is only used by
> filter_pred_strloc which only acts on strings for which the size of the
> type is 1.
> 

Was this visible in any of the tracepoints? Should this be marked for
stable? It's been in the kernel for a long time (2009). Or is a new
tracepoint showing a problem?

-- Steve

> Signed-off-by: Filipe Brandenburger <filbranden@google.com>
> ---
>  include/trace/ftrace.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 1a8b28d..82e8d89 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -375,7 +375,7 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call)	\
>  #define __dynamic_array(type, item, len)				\
>  	__data_offsets->item = __data_size +				\
>  			       offsetof(typeof(*entry), __data);	\
> -	__data_offsets->item |= (len * sizeof(type)) << 16;		\
> +	__data_offsets->item |= ((len) * sizeof(type)) << 16;		\
>  	__data_size += (len) * sizeof(type);
>  
>  #undef __string


  reply	other threads:[~2014-03-03 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-01  5:32 [PATCH 0/3] tracing: fix macro expansion and refactor some of dynamic_array support Filipe Brandenburger
2014-03-01  5:32 ` [PATCH 1/3] tracing: correctly expand len expressions from __dynamic_array macro Filipe Brandenburger
2014-03-03 19:51   ` Steven Rostedt [this message]
2014-03-03 19:57     ` Filipe Brandenburger
2014-03-01  5:32 ` [PATCH 2/3] tracing: evaluate len expression only once in " Filipe Brandenburger
2014-03-01  5:32 ` [PATCH 3/3] tracing: introduce a trace_data_offset struct to store array size Filipe Brandenburger
2014-03-03 20:48   ` Steven Rostedt
2014-03-03 20:59     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140303145110.0c09709c@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=filbranden@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).