All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
	Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH V2 01/10] perf tools: fix path unpopulated in machine__create_modules()
Date: Wed, 25 Sep 2013 12:45:48 -0300	[thread overview]
Message-ID: <20130925154548.GF2634@ghostprotocols.net> (raw)
In-Reply-To: <1379845338-29637-2-git-send-email-adrian.hunter@intel.com>

Em Sun, Sep 22, 2013 at 01:22:09PM +0300, Adrian Hunter escreveu:
> In machine__create_modules() the 'path' char array
> was used in a call to symbol__restricted_filename()
> without always being populated.
> 
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  tools/perf/util/machine.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 933d14f..ddf917b 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -785,14 +785,14 @@ static int machine__create_modules(struct machine *machine)
>  	const char *modules;
>  	char path[PATH_MAX];
>  
> -	if (machine__is_default_guest(machine))
> +	if (machine__is_default_guest(machine)) {
>  		modules = symbol_conf.default_guest_modules;
> -	else {
> -		sprintf(path, "%s/proc/modules", machine->root_dir);
> +	} else {
> +		snprintf(path, PATH_MAX, "%s/proc/modules", machine->root_dir);
>  		modules = path;
>  	}

While I don't dispute the above is an improvement, I think it is
unrelated to the fix described in the changeset comment, so I'm breaking
this patch into two and adding the strict fix to perf/urgent, the other
part (s/sprintf/snprintf/g) to perf/core, with respective explanation,

Thanks,

- Arnaldo

>  
> -	if (symbol__restricted_filename(path, "/proc/modules"))
> +	if (symbol__restricted_filename(modules, "/proc/modules"))
>  		return -1;
>  
>  	file = fopen(modules, "r");
> -- 
> 1.7.11.7

  reply	other threads:[~2013-09-25 15:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-22 10:22 [PATCH V2 00/10] perf tools: kcore improvements Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 01/10] perf tools: fix path unpopulated in machine__create_modules() Adrian Hunter
2013-09-25 15:45   ` Arnaldo Carvalho de Melo [this message]
2013-09-25 18:31   ` [tip:perf/urgent] perf machine: Fix " tip-bot for Adrian Hunter
2013-10-15  5:28   ` [tip:perf/core] perf machine: Use snprintf instead of sprintf tip-bot for Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 02/10] perf tools: make a separate function to parse /proc/modules Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 03/10] perf tools: validate kcore module addresses Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 04/10] perf tools: workaround objdump difficulties with kcore Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 05/10] perf tools: add map__find_other_map_symbol() Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 06/10] perf tools: fix annotate_browser__callq() Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 07/10] perf tools: find kcore symbols on other maps Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 08/10] perf tools: add copyfile_mode() Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 09/10] perf buildid-cache: add ability to add kcore to the cache Adrian Hunter
2013-09-22 10:22 ` [PATCH V2 10/10] perf tools: add ability to find kcore in build-id cache Adrian Hunter

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=20130925154548.GF2634@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.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.