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>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Song Liu <songliubraving@fb.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH 2/4] perf test: Pass the verbose option to shell tests
Date: Sat, 19 Jun 2021 10:03:36 -0300	[thread overview]
Message-ID: <YM3rKOlh0reN3Uaw@kernel.org> (raw)
In-Reply-To: <CAP-5=fXFgOz5V3_yCHEENtRsQdgCDEK=fWMri84FPD1ivC2w+A@mail.gmail.com>

Em Fri, Jun 18, 2021 at 09:45:05PM -0700, Ian Rogers escreveu:
> On Fri, Jun 18, 2021 at 9:49 AM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > Em Thu, Jun 17, 2021 at 04:19:06PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Thu, Jun 17, 2021 at 11:42:14AM -0700, Ian Rogers escreveu:
> > > > Having a verbose option will allow shell tests to provide extra failure
> > > > details when the fail or skip.
> > >
> > >
> > > Thanks, applied to perf/core.
> > >
> > > - Arnaldo
> > >
> > > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > > ---
> > > >  tools/perf/tests/builtin-test.c | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> > > > index cbbfe48ab802..a8160b1684de 100644
> > > > --- a/tools/perf/tests/builtin-test.c
> > > > +++ b/tools/perf/tests/builtin-test.c
> > > > @@ -577,11 +577,14 @@ struct shell_test {
> > > >  static int shell_test__run(struct test *test, int subdir __maybe_unused)
> > > >  {
> > > >     int err;
> > > > -   char script[PATH_MAX];
> > > > +   char script[PATH_MAX + 3];
> > > >     struct shell_test *st = test->priv;
> > > >
> > > >     path__join(script, sizeof(script), st->dir, st->file);
> >
> > probably you need to add a  '- 3' after the sizeof above, right?
> 
> Either way is fine, but -3 is ok with me.
> 
> > > >
> > > > +   if (verbose)
> > > > +           strncat(script, " -v", sizeof(script));
> > > > +
> >
> > Seemed simple enough, but gcc knows better, I'm removing this one:
> >
> >     tests/builtin-test.c:586:26: error: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Werror,-Wstrncat-size]
> >                     strncat(script, " -v", sizeof(script));
> >                                            ^~~~~~~~~~~~~~
> >     tests/builtin-test.c:586:26: note: change the argument to be the free space in the destination buffer minus the terminating null byte
> >                     strncat(script, " -v", sizeof(script));
> >                                            ^~~~~~~~~~~~~~
> >                                            sizeof(script) - strlen(script) - 1
> >     1 error generated.
> >     make[3]: *** [/git/perf-5.13.0-rc4/tools/build/Makefile.build:139: tests] Error 2
> >   77    31.98 ubuntu:21.04                  : FAIL gcc version 10.3.0 (Ubuntu 10.3.0-1ubuntu1)
> >     tests/builtin-test.c:586:26: error: the value of the size argument in 'strncat' is too large, might lead to a buffer overflow [-Werror,-Wstrncat-size]
> >                     strncat(script, " -v", sizeof(script));
> >                                            ^~~~~~~~~~~~~~
> >     tests/builtin-test.c:586:26: note: change the argument to be the free space in the destination buffer minus the terminating null byte
> >                     strncat(script, " -v", sizeof(script));
> >                                            ^~~~~~~~~~~~~~
> >                                            sizeof(script) - strlen(script) - 1
> >     1 error generated.
> >     make[3]: *** [/git/perf-5.13.0-rc4/tools/build/Makefile.build:139: tests] Error 2
> 
> Thanks gcc :-) Do you want me to resend the patch?

In such cases please do,

- Arnaldo

  reply	other threads:[~2021-06-19 13:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 18:42 [PATCH 1/4] perf test: Fix non-bash issue with stat bpf counters Ian Rogers
2021-06-17 18:42 ` [PATCH 2/4] perf test: Pass the verbose option to shell tests Ian Rogers
2021-06-17 19:19   ` Arnaldo Carvalho de Melo
2021-06-18 16:49     ` Arnaldo Carvalho de Melo
2021-06-19  4:45       ` Ian Rogers
2021-06-19 13:03         ` Arnaldo Carvalho de Melo [this message]
2021-06-17 18:42 ` [PATCH 3/4] perf test: Add verbose skip output for bpf counters Ian Rogers
2021-06-17 19:20   ` Arnaldo Carvalho de Melo
2021-06-17 18:42 ` [PATCH 4/4] perf test: Make stat bpf counters test more robust Ian Rogers
2021-06-17 19:21   ` Arnaldo Carvalho de Melo
2021-06-17 19:18 ` [PATCH 1/4] perf test: Fix non-bash issue with stat bpf counters Arnaldo Carvalho de Melo
2021-06-20 21:55 ` Stephen Rothwell
2021-06-21 21:30   ` Ian Rogers

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=YM3rKOlh0reN3Uaw@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --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 \
    --cc=songliubraving@fb.com \
    /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).