Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1589540lqt; Wed, 20 Mar 2024 08:20:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX07xuPHW1i9d9lkG20rnNtaxm1yhgPzsgfaATQaiYTWp32rOiUksFYfiZy9jzTcFwAwjmdZXg3WF7ECeyu93y7e/aCfXpFte2p6Iz6sw== X-Google-Smtp-Source: AGHT+IHonrTpGwt2camEFisSusiUE9z1cE3bfU/gCZWu0gmIVnUfe6RjbKDWKxSjk1hXJfUz+Hnt X-Received: by 2002:a05:6214:c4e:b0:696:22ab:3c0 with SMTP id r14-20020a0562140c4e00b0069622ab03c0mr10091762qvj.63.1710948041059; Wed, 20 Mar 2024 08:20:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710948041; cv=pass; d=google.com; s=arc-20160816; b=c6+QabJjDb5tRr6Bu1Dj3A2UQX2wh+WZUf9fzdmXPBMbRJqDi/ky6PxrhSCXo7j4yr E90R3xYh96z1fJdxCghj4QzSb4hpbnPak7f2oliSBAgRvcBmD8BOrBGrVc/EBu2xDeFx QeKs/EdX4PgSB49hbjZVgILtff7b5QkhcR4YMUPn+1ja0NgqAS4TCeCozeNBuJVW7Udx uOsbmiNSr7acuX+zOBWEAXcq69j2yPr/X6jsJRed0cxAKgm1N5vs7PVGviC0L2QICRQr N+2foUubR/Qnu+OrSV7MHiZHggG/9eLb2AQ2LO2O6xCeJGYffPqHTF5vT9PjezLWyGUc bg8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=th5uX5UBVDlQRZw88g8BHZxVtcRKnvqfSNpkcZLSncE=; fh=+nf3xsUObfH9Yp5NDiwu6oI02KIu+MFZ4MEudg/3pt8=; b=uBFVEaRRkMDWlkXIs01c9+ZcT+u02Vw7vZwopli0C5TXufLDe9xgKU9wtu5Uvp2pZO cSsQiXCDMMR099CwOpwJPQpULPWQlEjZEluealQYH4UZeLJCOo3epIu0rNWHBmO1+9fN DlnZ7GP9m7mVBNLGBgYegERXhJcPQvY+XC60+W3l5hVveIVARKNQ8iKAT/QWj9Qsqz61 k2vwZbbv9s3BvibmoatcbUsQRQ8F/qif23f5j0O7qIGIsS47PaWcX90p2ph3dBfhYU4Z Dg8Bow6FpXMrnHOFAm3ja7sPk2gO4SjkH1m0U/IHjfEV6/u09DeaoUcR/e2LrDgdXpCV zsLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e9M4499G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 13-20020a05621420cd00b0068f90fd3a59si12849955qve.219.2024.03.20.08.20.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 08:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e9M4499G; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-109077-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109077-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B5E9A1C2153D for ; Wed, 20 Mar 2024 15:20:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6AD95026C; Wed, 20 Mar 2024 15:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e9M4499G" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC75453E13; Wed, 20 Mar 2024 15:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710948020; cv=none; b=Wo31pBjy/RmHYVlKMJb8BkSwuBwywrglTbIgkAEutgydcNlPj/271a9Mw21CBBejC2OADhLMDgjfZPivR4P5NOkXWriZMImZKQ8VNh9evILeV/iFPwyW6nDKKr4Y+9RQjRfi4+n7+C7XUGlwEplyb6YdjIWb/ea6gmaGsP9dRPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710948020; c=relaxed/simple; bh=54Vizqm8R5gXNRXIjf4U1g4S2Pp7Ll+bTPE0UXhAVs8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mZ9x5+7F3ICeicCS8abkPxaM62n+Lg5j0h06QJaKh1Du1bljc4Hu1oRg0rpCN+OWt2RdchXncyf7xYs8OCizep/829gPTOrqVuQvZq7RpTU7iyil1PcD/hYdM/36HBWu1LsVaxr+KpGdVliTbDPkkE4ear1cX0lxOAbw6Wgi9JU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e9M4499G; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE1E9C43394; Wed, 20 Mar 2024 15:20:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710948020; bh=54Vizqm8R5gXNRXIjf4U1g4S2Pp7Ll+bTPE0UXhAVs8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e9M4499G8L8fSW+AWLB+NZsES79L67qbQzHs6R7r8feFml+Kn8RMZFLFu0wZnk/1U bUKQlpxWhCc5+IMUKK4ERoy94ujVQtQ+AkWOYSXsuModhGhLJJm1o10L/l8r0deX54 Zj5cKOutScBCNz6gfdfAsVKNhUfuUyYr/3ip7z1J5BME5t0CH/aBo5oLUxVNau2t8F eFt0FS8odvPcSDXtEzyNaK9Bgr0GiEkkYHjedpdkyzZaRfV6FZBXcLTaxeIIjHuTwy IJtEfFfCZ11nn0bXq0kgGDtwFic/3B9X+DhrKwsIiWag1owqhLPSByuncW+yshvQM+ GLbha148QQvyw== Date: Wed, 20 Mar 2024 12:20:17 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command Message-ID: References: <20240301201306.2680986-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Mar 20, 2024 at 08:12:56AM -0700, Ian Rogers wrote: > Ah, the change: > > - static int done_help; > + int done_help; > > created an uninitialized use. Compiler warning/sanitizers? Anyway, > done_help needs hoisting out of the loop and initializing to zero, or > being made static again (ugh). ⬢[acme@toolbox perf-tools-next]$ git diff diff --git a/tools/perf/perf.c b/tools/perf/perf.c index c719e6ccd9e27778..f9532b20e87cbf05 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -459,7 +459,7 @@ static int libperf_print(enum libperf_print_level level, int main(int argc, const char **argv) { - int err; + int err, done_help = 0; const char *cmd; char sbuf[STRERR_BUFSIZE]; @@ -558,8 +558,6 @@ int main(int argc, const char **argv) pthread__block_sigwinch(); while (1) { - int done_help; - run_argv(&argc, &argv); if (errno != ENOENT) ⬢[acme@toolbox perf-tools-next]$ perf raccord Fatal: Out of memory, realloc failed ⬢[acme@toolbox perf-tools-next]$ Then: diff --git a/tools/perf/perf.c b/tools/perf/perf.c index c719e6ccd9e27778..54f62aa6612bc290 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -558,7 +558,7 @@ int main(int argc, const char **argv) pthread__block_sigwinch(); while (1) { - int done_help; + static int done_help; run_argv(&argc, &argv); ⬢[acme@toolbox perf-tools-next]$ perf raccord Fatal: Out of memory, realloc failed ⬢[acme@toolbox perf-tools-next]$ - Arnaldo