All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH] perf daemon: Fix compile error with Asan
Date: Wed, 3 Mar 2021 12:54:56 -0300	[thread overview]
Message-ID: <YD+xUIkuoEcDkElI@kernel.org> (raw)
In-Reply-To: <YDYzRoig7zUWAVZM@krava>

Em Wed, Feb 24, 2021 at 12:06:46PM +0100, Jiri Olsa escreveu:
> On Wed, Feb 24, 2021 at 04:14:38PM +0900, Namhyung Kim wrote:
> > I'm seeing a build failure when build with address sanitizer.
> > It seems we could write to the name[100] if the var is longer.
> > 
> >   $ make EXTRA_CFLAGS=-fsanitize=address
> >   ...
> >     CC       builtin-daemon.o
> >   In function ‘get_session_name’,
> >     inlined from ‘session_config’ at builtin-daemon.c:164:6,
> >     inlined from ‘server_config’ at builtin-daemon.c:223:10:
> >   builtin-daemon.c:155:11: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
> >     155 |  *session = 0;
> >         |  ~~~~~~~~~^~~
> >   builtin-daemon.c: In function ‘server_config’:
> >   builtin-daemon.c:162:7: note: at offset 100 to object ‘name’ with size 100 declared here
> >     162 |  char name[100];
> >         |       ^~~~
> > 
> > Fixes: c0666261ff38 ("perf daemon: Add config file support")
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, applied.

- Arnaldo

 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/builtin-daemon.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
> > index 617feaf020f6..8f9fc61691da 100644
> > --- a/tools/perf/builtin-daemon.c
> > +++ b/tools/perf/builtin-daemon.c
> > @@ -161,7 +161,7 @@ static int session_config(struct daemon *daemon, const char *var, const char *va
> >  	struct daemon_session *session;
> >  	char name[100];
> >  
> > -	if (get_session_name(var, name, sizeof(name)))
> > +	if (get_session_name(var, name, sizeof(name) - 1))
> >  		return -EINVAL;
> >  
> >  	var = strchr(var, '.');
> > -- 
> > 2.30.0.617.g56c4b15f3c-goog
> > 
> 

-- 

- Arnaldo

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24  7:14 [PATCH] perf daemon: Fix compile error with Asan Namhyung Kim
2021-02-24 11:06 ` Jiri Olsa
2021-03-03 15:54   ` Arnaldo Carvalho de Melo [this message]

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=YD+xUIkuoEcDkElI@kernel.org \
    --to=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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.