diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-27 20:19:05 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-27 20:19:05 -0400 |
commit | 48ea8f5470aa6f35244d1b218316705ea88c0259 (patch) | |
tree | b4e9a2d1cc227be96f2c3de815b5b2b4c12e3cb5 /tools/perf/util/map.c | |
parent | 23346f21b277e3aae5e9989e711a11cbe8133a45 (diff) |
perf machine: Pass buffer size to machine__mmap_name
Don't blindly assume that the size of the buffer is enough, use
snprintf.
Cc: Avi Kivity <avi@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r-- | tools/perf/util/map.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index da3d4e826231..ee25ee91504b 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -629,14 +629,14 @@ void machines__process(struct rb_root *self, machine__process_t process, void *d | |||
629 | } | 629 | } |
630 | } | 630 | } |
631 | 631 | ||
632 | char *machine__mmap_name(struct machine *self, char *buff) | 632 | char *machine__mmap_name(struct machine *self, char *bf, size_t size) |
633 | { | 633 | { |
634 | if (machine__is_host(self)) | 634 | if (machine__is_host(self)) |
635 | sprintf(buff, "[%s]", "kernel.kallsyms"); | 635 | snprintf(bf, size, "[%s]", "kernel.kallsyms"); |
636 | else if (machine__is_default_guest(self)) | 636 | else if (machine__is_default_guest(self)) |
637 | sprintf(buff, "[%s]", "guest.kernel.kallsyms"); | 637 | snprintf(bf, size, "[%s]", "guest.kernel.kallsyms"); |
638 | else | 638 | else |
639 | sprintf(buff, "[%s.%d]", "guest.kernel.kallsyms", self->pid); | 639 | snprintf(bf, size, "[%s.%d]", "guest.kernel.kallsyms", self->pid); |
640 | 640 | ||
641 | return buff; | 641 | return bf; |
642 | } | 642 | } |