Commit 49a5e3ed authored by Jiri Olsa's avatar Jiri Olsa Committed by Namhyung Kim

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: 92294b90 ("perf daemon: Dynamically allocate path to perf")
Reported-and-Tested-by: default avatarNamhyung Kim <namhyung@kernel.org>
Reported-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Signed-off-by: default avatarJiri 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.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
parent 929ff679
...@@ -1524,7 +1524,7 @@ int cmd_daemon(int argc, const char **argv) ...@@ -1524,7 +1524,7 @@ int cmd_daemon(int argc, const char **argv)
if (argc) { if (argc) {
if (!strcmp(argv[0], "start")) if (!strcmp(argv[0], "start"))
ret = __cmd_start(&__daemon, daemon_options, argc, argv); 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); ret = __cmd_signal(&__daemon, daemon_options, argc, argv);
else if (!strcmp(argv[0], "stop")) else if (!strcmp(argv[0], "stop"))
ret = __cmd_stop(&__daemon, daemon_options, argc, argv); ret = __cmd_stop(&__daemon, daemon_options, argc, argv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment