mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Tom Zanussi <zanussi@kernel.org>,
	kernel test robot <lkp@intel.com>
Subject: [for-next][PATCH 07/11] tracing: Fix trace_event_raw_event_synth() if else statement
Date: Tue, 07 Feb 2023 20:56:40 -0500	[thread overview]
Message-ID: <20230208015731.669243610@goodmis.org> (raw)
In-Reply-To: <20230208015633.791198913@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The test to check if the field is a stack is to be done if it is not a
string. But the code had:

    } if (event->fields[i]->is_stack) {

and not

   } else if (event->fields[i]->is_stack) {

which would cause it to always be tested. Worse yet, this also included an
"else" statement that was only to be called if the field was not a string
and a stack, but this code allows it to be called if it was a string (and
not a stack).

Also fixed some whitespace issues.

Link: https://lore.kernel.org/all/202301302110.mEtNwkBD-lkp@intel.com/
Link: https://lore.kernel.org/linux-trace-kernel/20230131095237.63e3ca8d@gandalf.local.home

Cc: Tom Zanussi <zanussi@kernel.org>
Fixes: 00cf3d672a9d ("tracing: Allow synthetic events to pass around stacktraces")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 kernel/trace/trace_events_synth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index adb630633f31..306c89e0ce55 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -564,8 +564,8 @@ static notrace void trace_event_raw_event_synth(void *__data,
 					   event->fields[i]->is_dynamic,
 					   data_size, &n_u64);
 			data_size += len; /* only dynamic string increments */
-		} if (event->fields[i]->is_stack) {
-		        long *stack = (long *)(long)var_ref_vals[val_idx];
+		} else if (event->fields[i]->is_stack) {
+			long *stack = (long *)(long)var_ref_vals[val_idx];
 
 			len = trace_stack(entry, event, stack,
 					   data_size, &n_u64);
-- 
2.39.1

  parent reply	other threads:[~2023-02-08  1:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  1:56 [for-next][PATCH 00/11] tracing: Updates for 6.3 Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 01/11] tracing/osnoise: No need for schedule_hrtimeout range Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 02/11] tracing/histogram: Wrap remaining shell snippets in code blocks Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 03/11] tracing: Acquire buffer from temparary trace sequence Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 04/11] samples: ftrace: Include the nospec-branch.h only for x86 Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 05/11] ftrace: sample: avoid open-coded 64-bit division Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 06/11] samples: ftrace: Make some global variables static Steven Rostedt
2023-02-08  1:56 ` Steven Rostedt [this message]
2023-02-08  1:56 ` [for-next][PATCH 08/11] tracing: Add creation of instances at boot command line Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 09/11] tracing: Add enabling of events to boot instances Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 10/11] tracing: Add trace_array_puts() to write into instance Steven Rostedt
2023-02-08  1:56 ` [for-next][PATCH 11/11] tracing: Allow boot instances to have snapshot buffers 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=20230208015731.669243610@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=zanussi@kernel.org \
    /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

all inboxes | Powered by JetHome®