* [PATCH] perf tests: Fix compile failure on do_sort_something - v2
@ 2013-08-14 4:32 David Ahern
2013-08-14 11:05 ` Adrian Hunter
2013-08-15 7:57 ` [tip:perf/core] perf tests: Fix compile failure on do_sort_something tip-bot for David Ahern
0 siblings, 2 replies; 4+ messages in thread
From: David Ahern @ 2013-08-14 4:32 UTC (permalink / raw)
To: acme, linux-kernel; +Cc: David Ahern, Adrian Hunter, Jiri Olsa
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....
v2: as Adrian noticed changed sizeof to ARRAY_SIZE
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 eec1421..df9afd9 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)ARRAY_SIZE(buf); i++)
+ buf[i] = ARRAY_SIZE(buf) - i - 1;
- qsort(buf, sz, sizeof(int), comp);
+ qsort(buf, ARRAY_SIZE(buf), sizeof(int), comp);
- for (i = 0; i < (int)sz; i++) {
+ for (i = 0; i < (int)ARRAY_SIZE(buf); i++) {
if (buf[i] != i) {
pr_debug("qsort failed\n");
break;
--
1.7.10.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] perf tests: Fix compile failure on do_sort_something - v2
2013-08-14 4:32 [PATCH] perf tests: Fix compile failure on do_sort_something - v2 David Ahern
@ 2013-08-14 11:05 ` Adrian Hunter
2013-08-14 14:22 ` Arnaldo Carvalho de Melo
2013-08-15 7:57 ` [tip:perf/core] perf tests: Fix compile failure on do_sort_something tip-bot for David Ahern
1 sibling, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2013-08-14 11:05 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel, Jiri Olsa
On 14/08/13 07:32, 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....
>
> v2: as Adrian noticed changed sizeof to ARRAY_SIZE
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.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 eec1421..df9afd9 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)ARRAY_SIZE(buf); i++)
> + buf[i] = ARRAY_SIZE(buf) - i - 1;
>
> - qsort(buf, sz, sizeof(int), comp);
> + qsort(buf, ARRAY_SIZE(buf), sizeof(int), comp);
>
> - for (i = 0; i < (int)sz; i++) {
> + for (i = 0; i < (int)ARRAY_SIZE(buf); i++) {
> if (buf[i] != i) {
> pr_debug("qsort failed\n");
> break;
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] perf tests: Fix compile failure on do_sort_something - v2
2013-08-14 11:05 ` Adrian Hunter
@ 2013-08-14 14:22 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-08-14 14:22 UTC (permalink / raw)
To: Adrian Hunter; +Cc: David Ahern, linux-kernel, Jiri Olsa
Em Wed, Aug 14, 2013 at 02:05:52PM +0300, Adrian Hunter escreveu:
> On 14/08/13 07:32, David Ahern wrote:
> > Commit b55ae0a9 added code-reading.c which fails to compile on Fedora 16
> > with compiler version:
> > Signed-off-by: David Ahern <dsahern@gmail.com>
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Jiri Olsa <jolsa@redhat.com>
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Applied
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] perf tests: Fix compile failure on do_sort_something
2013-08-14 4:32 [PATCH] perf tests: Fix compile failure on do_sort_something - v2 David Ahern
2013-08-14 11:05 ` Adrian Hunter
@ 2013-08-15 7:57 ` tip-bot for David Ahern
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for David Ahern @ 2013-08-15 7:57 UTC (permalink / raw)
To: linux-tip-commits
Cc: acme, linux-kernel, hpa, mingo, jolsa, dsahern, adrian.hunter,
tglx
Commit-ID: 309b5185047c5309bbc576025f6c5e257edd9f69
Gitweb: http://git.kernel.org/tip/309b5185047c5309bbc576025f6c5e257edd9f69
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 13 Aug 2013 22:32:12 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 14 Aug 2013 11:42:45 -0300
perf tests: Fix compile failure on do_sort_something
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....
v2: as Adrian noticed changed sizeof to ARRAY_SIZE
Signed-off-by: David Ahern <dsahern@gmail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1376454732-83728-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@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 eec1421..df9afd9 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)ARRAY_SIZE(buf); i++)
+ buf[i] = ARRAY_SIZE(buf) - i - 1;
- qsort(buf, sz, sizeof(int), comp);
+ qsort(buf, ARRAY_SIZE(buf), sizeof(int), comp);
- for (i = 0; i < (int)sz; i++) {
+ for (i = 0; i < (int)ARRAY_SIZE(buf); i++) {
if (buf[i] != i) {
pr_debug("qsort failed\n");
break;
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-15 7:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 4:32 [PATCH] perf tests: Fix compile failure on do_sort_something - v2 David Ahern
2013-08-14 11:05 ` Adrian Hunter
2013-08-14 14:22 ` Arnaldo Carvalho de Melo
2013-08-15 7:57 ` [tip:perf/core] perf tests: Fix compile failure on do_sort_something tip-bot for David Ahern
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).