diff mbox series

[v2] trace-cmd split: Initialize current in parse_file()

Message ID 20240124124927.3551e982@gandalf.local.home (mailing list archive)
State Accepted
Commit 3b6096fc8d2865fae0deafc2723aec8c7742342e
Headers show
Series [v2] trace-cmd split: Initialize current in parse_file() | expand

Commit Message

Steven Rostedt Jan. 24, 2024, 5:49 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The code fix to correctly split start/end/time-window parameters removed
an initialization of "current" which can now fall out being uninitialized
and used for a later compare.

Found with valgrind.

Link: https://lore.kernel.org/linux-trace-devel/20240124122832.4e0b33b7@gandalf.local.home/

Fixes: 1439b8f518 ("trace-cmd split: Correctly split with start/end/time-window parameters")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
Changes since v1: https://lore.kernel.org/all/20240124123439.3441eb6f@gandalf.local.home/

 - rebase on the fixed commit, not in the middle of the other split patches

 tracecmd/trace-split.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tracecmd/trace-split.c b/tracecmd/trace-split.c
index b6c056b5f34b..8c710da15f78 100644
--- a/tracecmd/trace-split.c
+++ b/tracecmd/trace-split.c
@@ -358,7 +358,7 @@  static unsigned long long parse_file(struct tracecmd_input *handle,
 				     enum split_types type,
 				     bool *end_reached)
 {
-	unsigned long long current;
+	unsigned long long current = 0;
 	struct tracecmd_output *ohandle;
 	struct cpu_data *cpu_data;
 	struct tep_record *record;