Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16673068rwd; Mon, 26 Jun 2023 13:26:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4wTBb6dq6EL9DZlUbp5epTtsJ3byGUTb5RqZB4xvPOv/3IAqV6HlkvoYjfR6VvdGTm3nhb X-Received: by 2002:a17:902:e88e:b0:1b6:b40c:b022 with SMTP id w14-20020a170902e88e00b001b6b40cb022mr9731426plg.30.1687811210410; Mon, 26 Jun 2023 13:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687811210; cv=none; d=google.com; s=arc-20160816; b=uM4moi8uhJpmNnGF1KBaNHNMpDHC0A8Ks5VjFwuqWZDftktMPbp5yNNJNidv1xSucN TyXHDDDcvahfSaZJIAsFvoYwOaPEq7ynQIj34SpsWzsLb5vnoULnD/AguEr/sR34z+vA li319DzLAMsYk35x9rJhv6E7FtdNXtm43CfZPPBlbfsVz91XWMlBruayS6C/PDAIHkaX dvYlWgQvqHurzT5YYUJ3L8HwIeAJRTF5ikoWzFDxDgQC1ARuZf9zrWcV+DVLclAGWa+e FnrYJEEjSdYv/1W45uGM9NZ7tn7pUP5/GUlqSL+bHRoOL72JNsx8TPZHHLokhlEkWVpq DpyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=z5pr0PihcVU61SZr15BA1PAdflr6Yw5TSGmSiX1W8GY=; fh=ie7M2DgD87IQ1d59dQ0YcxSX7+a1yHkv++WgNgnkSgg=; b=jFZc/48c8Ze8yy6j1DOSUFFiSrrgj1/fbkxV8xA/8v1NKfKQHbUr+QcjqbqZDbsxbi b67QnbclACqtg/A8SdylG1Z6ZWshZjJgOeSm1e4AgkkwyTsWVSBK5IZBqD/9HN7Ak3Fx 7y8FLi2asr5c912TJD8i3IZh8CrNxwXWPbOS6GDmKzQL5FRxflU59MeVQqiu068yXE3Q FnRj9U2mTHTvHfvbfSWn1CE/TVTRiOW2dmWeaQa0oNroiSWaXGFb0RoSNwE4ZQORVjxI 15R7A+u3p5IRzSA7sR9Uukr4Y1zRRC65QEEAEWvj8ujknH4lrR5X2kIbiPPT38yHXxPD mXCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P9u+7v/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je5-20020a170903264500b001b7ffbfcfd6si2828779plb.544.2023.06.26.13.26.38; Mon, 26 Jun 2023 13:26:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P9u+7v/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbjFZUQP (ORCPT + 99 others); Mon, 26 Jun 2023 16:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbjFZUQO (ORCPT ); Mon, 26 Jun 2023 16:16:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6FA9E4; Mon, 26 Jun 2023 13:16:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FF3860DFA; Mon, 26 Jun 2023 20:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B296C433C0; Mon, 26 Jun 2023 20:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687810572; bh=5BDJLetXXf3y8IYgHBV9UPex77ekTt4y/ajL2pcgjdQ=; h=From:To:Cc:Subject:Date:From; b=P9u+7v/Ye/PUDn5GmLPJ0/nM8sGaVBDBsCgui9Nl9qEC0FZWtAW6lvfyyrYNgJPto 0JHkmIqcvnwZUMKJwi/PT4iAyjuiCPYGusStHTQZkFpTitl5rWW0MUJiqm/vALG5+M MmhSHI030QvblwCFOarjCuSnip8HN8bAnD50m2s52242LUhVQEx16WHlWH/6E2p+1w ym0ZofAT2qaM/lyVW3UfNOPKdJbw0+a7OIzR8zSLu/3/voyHIA+m3ZlTZ/9OpybfQ+ W6scvHIcTcXCN5xEaKSgxvzptwckxqpeASYKefAg3Gcqn7vG/C4hLvr+nPLhQHyNSC wjLhGedJ4R9fQ== From: Jiri Olsa To: Arnaldo Carvalho de Melo , Namhyung Kim Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org Subject: [PATCH] perf tools: Add missing else to cmd_daemon subcommand condition Date: Mon, 26 Jun 2023 22:16:05 +0200 Message-ID: <20230626201606.2514679-1-jolsa@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-by: Namhyung Kim Signed-off-by: Jiri Olsa --- tools/perf/builtin-daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.41.0