* [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain
@ 2010-11-06 8:47 Cyrill Gorcunov
2010-11-07 21:49 ` Frederic Weisbecker
0 siblings, 1 reply; 3+ messages in thread
From: Cyrill Gorcunov @ 2010-11-06 8:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: LKML, Frédéric Weisbecker, Ingo Molnar
The gcc complains on Yes, No being allocated from stack space. Make
them conts to feel compiler happy.
| CC util/ui/util.o
| cc1: warnings being treated as errors
| util/ui/util.c: In function ‘ui__dialog_yesno’:
| util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
| make: *** [util/ui/util.o] Error 1
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Arnaldo Carvalho de Melo <acme@redhat.com>
CC: Frédéric Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@elte.hu>
---
Since it seems only me who has such error I presume ssp-buffer-size=8 set
for mine local version of gcc (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4))
tools/perf/util/ui/util.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: linux-2.6.git/tools/perf/util/ui/util.c
=====================================================================
--- linux-2.6.git.orig/tools/perf/util/ui/util.c
+++ linux-2.6.git/tools/perf/util/ui/util.c
@@ -104,9 +104,10 @@ out_destroy_form:
return rc;
}
+static const char yes[] = "Yes", no[] = "No";
+
bool ui__dialog_yesno(const char *msg)
{
/* newtWinChoice should really be accepting const char pointers... */
- char yes[] = "Yes", no[] = "No";
- return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
+ return newtWinChoice(NULL, (char *)yes, (char *)no, (char *)msg) == 1;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain
2010-11-06 8:47 [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain Cyrill Gorcunov
@ 2010-11-07 21:49 ` Frederic Weisbecker
2010-11-07 21:51 ` Cyrill Gorcunov
0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2010-11-07 21:49 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: Arnaldo Carvalho de Melo, LKML, Ingo Molnar
On Sat, Nov 06, 2010 at 11:47:24AM +0300, Cyrill Gorcunov wrote:
> The gcc complains on Yes, No being allocated from stack space. Make
> them conts to feel compiler happy.
>
> | CC util/ui/util.o
> | cc1: warnings being treated as errors
> | util/ui/util.c: In function ‘ui__dialog_yesno’:
> | util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
> | make: *** [util/ui/util.o] Error 1
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> CC: Arnaldo Carvalho de Melo <acme@redhat.com>
> CC: Frédéric Weisbecker <fweisbec@gmail.com>
> CC: Ingo Molnar <mingo@elte.hu>
> ---
I hope we can finally queue this one fix, the warning is there
for a while now, and this patch looks quite sensible :)
>
> Since it seems only me who has such error I presume ssp-buffer-size=8 set
> for mine local version of gcc (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4))
>
> tools/perf/util/ui/util.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.git/tools/perf/util/ui/util.c
> =====================================================================
> --- linux-2.6.git.orig/tools/perf/util/ui/util.c
> +++ linux-2.6.git/tools/perf/util/ui/util.c
> @@ -104,9 +104,10 @@ out_destroy_form:
> return rc;
> }
>
> +static const char yes[] = "Yes", no[] = "No";
> bool ui__dialog_yesno(const char *msg)
> {
> /* newtWinChoice should really be accepting const char pointers... */
> - char yes[] = "Yes", no[] = "No";
> - return newtWinChoice(NULL, yes, no, (char *)msg) == 1;
> + return newtWinChoice(NULL, (char *)yes, (char *)no, (char *)msg) == 1;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain
2010-11-07 21:49 ` Frederic Weisbecker
@ 2010-11-07 21:51 ` Cyrill Gorcunov
0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2010-11-07 21:51 UTC (permalink / raw)
To: Frederic Weisbecker; +Cc: Arnaldo Carvalho de Melo, LKML, Ingo Molnar
On Sun, Nov 07, 2010 at 10:49:02PM +0100, Frederic Weisbecker wrote:
> On Sat, Nov 06, 2010 at 11:47:24AM +0300, Cyrill Gorcunov wrote:
> > The gcc complains on Yes, No being allocated from stack space. Make
> > them conts to feel compiler happy.
> >
> > | CC util/ui/util.o
> > | cc1: warnings being treated as errors
> > | util/ui/util.c: In function ‘ui__dialog_yesno’:
> > | util/ui/util.c:108: error: not protecting function: no buffer at least 8 bytes long
> > | make: *** [util/ui/util.o] Error 1
> >
> > Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> > CC: Arnaldo Carvalho de Melo <acme@redhat.com>
> > CC: Frédéric Weisbecker <fweisbec@gmail.com>
> > CC: Ingo Molnar <mingo@elte.hu>
> > ---
>
> I hope we can finally queue this one fix, the warning is there
> for a while now, and this patch looks quite sensible :)
>
yup, thanks for review ;)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-07 21:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-06 8:47 [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain Cyrill Gorcunov
2010-11-07 21:49 ` Frederic Weisbecker
2010-11-07 21:51 ` Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox