summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-daemon.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2023-06-26 22:16:05 +0200
committerNamhyung Kim <namhyung@kernel.org>2023-06-27 21:09:44 +0200
commit49a5e3edd35352833270dd18b0d5ca414fcc9406 (patch)
tree6bf27803107ff8c7ac3365dab696b61ffeb21e39 /tools/perf/builtin-daemon.c
parentperf tools: Add printing perf_event_attr config symbol in perf_event_attr__fp... (diff)
downloadlinux-49a5e3edd35352833270dd18b0d5ca414fcc9406.tar.xz
linux-49a5e3edd35352833270dd18b0d5ca414fcc9406.zip
perf tools: Add missing else to cmd_daemon subcommand condition
Namhyung reported segfault in perf daemon start command. It's caused by extra check on argv[0] which is set to NULL by previous __cmd_start call. Adding missing else to skip the extra check. Fixes: 92294b906e6c ("perf daemon: Dynamically allocate path to perf") Reported-and-Tested-by: Namhyung Kim <namhyung@kernel.org> Reported-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Link: https://lore.kernel.org/r/20230626201606.2514679-1-jolsa@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/builtin-daemon.c')
-rw-r--r--tools/perf/builtin-daemon.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
index f5674d824a40..83954af36753 100644
--- a/tools/perf/builtin-daemon.c
+++ b/tools/perf/builtin-daemon.c
@@ -1524,7 +1524,7 @@ int cmd_daemon(int argc, const char **argv)
if (argc) {
if (!strcmp(argv[0], "start"))
ret = __cmd_start(&__daemon, daemon_options, argc, argv);
- if (!strcmp(argv[0], "signal"))
+ else if (!strcmp(argv[0], "signal"))
ret = __cmd_signal(&__daemon, daemon_options, argc, argv);
else if (!strcmp(argv[0], "stop"))
ret = __cmd_stop(&__daemon, daemon_options, argc, argv);