projects/linux·commit 434fffa9

perf probe: Fix uninitialized variable

434fffa9 · James Clark <[email protected]> · 2024-12-11 08:55:23 +00:00

Since the linked fixes: commit, err is returned uninitialized due to the
removal of "return 0". Initialize err to fix it.

This fixes the following intermittent test failure on release builds:

 $ perf test "testsuite_probe"
 ...
 -- [ FAIL ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar (output regexp parsing)
 Regexp not found: \"Error: switch .+ cannot be used with switch .+\"
 ...

Fixes: 080e47b2a237 ("perf probe: Introduce quotation marks support")
Tested-by: Namhyung Kim <[email protected]>
Reviewed-by: Arnaldo Carvalho de Melo <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: James Clark <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Commit
434fffa926b10706f2bde2db22979d68463302fc
Parents
f7e36d02

Changes

1 files changed · +1 −1

FileStatusAddDelContent
tools/perf/util/probe-event.cmodified+1−1View file

tools/perf/util/probe-event.c

View file
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 6d51a4c..eaa0318 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1370,7 +1370,7 @@ int parse_line_range_desc(const char *arg, struct line_range *lr)
{
char *buf = strdup(arg);
char *p;
- int err;
+ int err = 0;
if (!buf)
return -ENOMEM;