Skip to contentSkip to conversation

perf inject: Fix use without initialization of local variables

PATCH Applied Ian Rogers 3 participants 3 messages Dec 11, 2024 – Jan 13, 2025 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf inject: Fix use without initialization of local variables

Local variables were missing initialization and command line processing didn't provide default values.

Fixes 64eed019f3fc ("perf inject: Lazy build-id mmap2 event insertion")
---
 tools/perf/builtin-inject.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/builtin-inject.c +4 -4
index d6989195a061..11e49cafa3af 100644
@@ -2367,10 +2367,10 @@ int cmd_inject(int argc, const char **argv)
 	};
 	int ret;
 	const char *known_build_ids = NULL;
-	bool build_ids;
-	bool build_id_all;
-	bool mmap2_build_ids;
-	bool mmap2_build_id_all;
+	bool build_ids = false;
+	bool build_id_all = false;
+	bool mmap2_build_ids = false;
+	bool mmap2_build_id_all = false;
 
 	struct option options[] = {
 		OPT_BOOLEAN('b', "build-ids", &build_ids,
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Ian Rogers

Local variables were missing initialization and command line processing didn't provide default values.

Fixes 64eed019f3fc ("perf inject: Lazy build-id mmap2 event insertion")
---
  tools/perf/builtin-inject.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/builtin-inject.c +0 -1
index d6989195a061..11e49cafa3af 100644
@@ -2367,10 +2367,10 @@ int cmd_inject(int argc, const char **argv)
  	};
  	int ret;
  	const char *known_build_ids = NULL;
-	bool build_ids;

tools/perf/builtin-inject.c int cmd_inject(int argc, const char **argv) · line 2376

Quoted 10 lines
tools/perf/builtin-inject.c +4 -3
-	bool build_id_all;
-	bool mmap2_build_ids;
-	bool mmap2_build_id_all;
+	bool build_ids = false;
+	bool build_id_all = false;
+	bool mmap2_build_ids = false;
+	bool mmap2_build_id_all = false;
 
  	struct option options[] = {
  		OPT_BOOLEAN('b', "build-ids", &build_ids,
maintainer Applied
#2 lore raw
Quoted 22 lines · James Clark
Quoted 21 lines · Ian Rogers

Local variables were missing initialization and command line processing didn't provide default values.

Fixes 64eed019f3fc ("perf inject: Lazy build-id mmap2 event insertion")
---
  tools/perf/builtin-inject.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/builtin-inject.c +0 -4
index d6989195a061..11e49cafa3af 100644
@@ -2367,10 +2367,10 @@ int cmd_inject(int argc, const char **argv)
  	};
  	int ret;
  	const char *known_build_ids = NULL;
-	bool build_ids;
-	bool build_id_all;
-	bool mmap2_build_ids;
-	bool mmap2_build_id_all;
Quoted 8 lines

tools/perf/builtin-inject.c int cmd_inject(int argc, const char **argv) · line 2376

Quoted 6 lines
tools/perf/builtin-inject.c +4 -0
+	bool build_ids = false;
+	bool build_id_all = false;
+	bool mmap2_build_ids = false;
+	bool mmap2_build_id_all = false;
  	struct option options[] = {
  		OPT_BOOLEAN('b', "build-ids", &build_ids,

Thanks, applied to perf-tools-next,

- Arnaldo