From: Adrian Hunter <adrian.hunter@intel.com>
To: David Ahern <dsahern@gmail.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH] perf tests: Fix compile failure on do_sort_something
Date: Thu, 08 Aug 2013 08:58:19 +0300 [thread overview]
Message-ID: <5203337B.4040906@intel.com> (raw)
In-Reply-To: <1375912782-74921-1-git-send-email-dsahern@gmail.com>
On 08/08/13 00:59, David Ahern wrote:
> Commit b55ae0a9 added code-reading.c which fails to compile on Fedora 16
> with compiler version:
> $ gcc --version
> gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)
>
> Failure message is:
>
> tests/code-reading.c: In function ‘do_sort_something’:
> tests/code-reading.c:305:13: error: stack protector not protecting local variables: variable length buffer [-Werror=stack-protector]
> cc1: all warnings being treated as errors
> make: *** [/tmp/junk/tests/code-reading.o] Error 1
> make: *** Waiting for unfinished jobs....
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
> tools/perf/tests/code-reading.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 8e0943b..4bde8be 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -304,15 +304,14 @@ static int comp(const void *a, const void *b)
>
> static void do_sort_something(void)
> {
> - size_t sz = 40960;
> - int buf[sz], i;
> + int buf[40960], i;
>
> - for (i = 0; i < (int)sz; i++)
> - buf[i] = sz - i - 1;
> + for (i = 0; i < (int)sizeof(buf); i++)
Should that be ARRAY_SIZE not sizeof
> + buf[i] = sizeof(buf) - i - 1;
>
> - qsort(buf, sz, sizeof(int), comp);
> + qsort(buf, sizeof(buf), sizeof(int), comp);
>
> - for (i = 0; i < (int)sz; i++) {
> + for (i = 0; i < (int)sizeof(buf); i++) {
> if (buf[i] != i) {
> pr_debug("qsort failed\n");
> break;
>
next prev parent reply other threads:[~2013-08-08 5:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-07 21:59 [PATCH] perf tests: Fix compile failure on do_sort_something David Ahern
2013-08-08 5:58 ` Adrian Hunter [this message]
2013-08-09 3:09 ` David Ahern
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=5203337B.4040906@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@ghostprotocols.net \
--cc=dsahern@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.