linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command
Date: Wed, 20 Mar 2024 12:20:17 -0300	[thread overview]
Message-ID: <Zfr-sQJPbZzbtk8K@x1> (raw)
In-Reply-To: <CAP-5=fXXrJRH=Dto2ajD_TUDE1YmkkJZO5Ey2pq5YB0wbVAzeg@mail.gmail.com>

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

  reply	other threads:[~2024-03-20 15:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 20:13 [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command Ian Rogers
2024-03-01 20:13 ` [PATCH v2 2/2] perf help: Lower levenshtein penality for deleting character Ian Rogers
2024-03-20 14:54 ` [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command Arnaldo Carvalho de Melo
2024-03-20 15:00   ` Arnaldo Carvalho de Melo
2024-03-20 15:12     ` Ian Rogers
2024-03-20 15:20       ` Arnaldo Carvalho de Melo [this message]
2024-03-20 15:25         ` Ian Rogers
2024-03-20 15:32         ` Arnaldo Carvalho de Melo
2024-03-20 15:40           ` Ian Rogers
2024-03-20 15:41           ` Arnaldo Carvalho de Melo
2024-03-20 15:44             ` Arnaldo Carvalho de Melo
2024-03-20 17:07               ` Ian Rogers
2024-03-20 19:34                 ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zfr-sQJPbZzbtk8K@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).