public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain
Date: Sun, 7 Nov 2010 22:49:02 +0100	[thread overview]
Message-ID: <20101107214900.GE11134@nowhere> (raw)
In-Reply-To: <20101106084724.GA5956@lenovo>

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;
>  }


  reply	other threads:[~2010-11-07 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-06  8:47 [PATCH] perf, ui: Eliminate stack-smashing protection compiler complain Cyrill Gorcunov
2010-11-07 21:49 ` Frederic Weisbecker [this message]
2010-11-07 21:51   ` Cyrill Gorcunov

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=20101107214900.GE11134@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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