*/
struct process_symbol_args args = { .name = symbol_name, };
- mmap_name = machine__mmap_name(machine, name_buff);
+ mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff));
if (machine__is_host(machine)) {
/*
* kernel uses PERF_RECORD_MISC_USER for user space maps,
goto out_problem;
}
- machine__mmap_name(machine, kmmap_prefix);
+ machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix));
if (machine__is_host(machine))
kernel_type = DSO_TYPE_KERNEL;
else
}
}
-char *machine__mmap_name(struct machine *self, char *buff)
+char *machine__mmap_name(struct machine *self, char *bf, size_t size)
{
if (machine__is_host(self))
- sprintf(buff, "[%s]", "kernel.kallsyms");
+ snprintf(bf, size, "[%s]", "kernel.kallsyms");
else if (machine__is_default_guest(self))
- sprintf(buff, "[%s]", "guest.kernel.kallsyms");
+ snprintf(bf, size, "[%s]", "guest.kernel.kallsyms");
else
- sprintf(buff, "[%s.%d]", "guest.kernel.kallsyms", self->pid);
+ snprintf(bf, size, "[%s.%d]", "guest.kernel.kallsyms", self->pid);
- return buff;
+ return bf;
}
struct machine *machines__find_host(struct rb_root *self);
struct machine *machines__find(struct rb_root *self, pid_t pid);
struct machine *machines__findnew(struct rb_root *self, pid_t pid);
-char *machine__mmap_name(struct machine *self, char *buff);
+char *machine__mmap_name(struct machine *self, char *bf, size_t size);
/*
* Default guest kernel is defined by parameter --guestkallsyms
out_try_fixup:
if (err > 0) {
if (kallsyms_filename != NULL) {
- machine__mmap_name(machine, path);
+ machine__mmap_name(machine, path, sizeof(path));
dso__set_long_name(self, strdup(path));
}
map__fixup_start(map);
static struct dso *dso__new_guest_kernel(struct machine *machine,
const char *name)
{
- char buff[PATH_MAX];
- struct dso *self = dso__new(name ?: machine__mmap_name(machine, buff));
+ char bf[PATH_MAX];
+ struct dso *self = dso__new(name ?: machine__mmap_name(machine, bf, sizeof(bf)));
if (self != NULL) {
dso__set_short_name(self, "[guest.kernel]");