perf tools: Future-proof thread_map allocation size calculation

Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20150625174840.GH3253@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 27451700
...@@ -22,7 +22,7 @@ static int filter(const struct dirent *dir) ...@@ -22,7 +22,7 @@ static int filter(const struct dirent *dir)
static struct thread_map *thread_map__realloc(struct thread_map *map, int nr) static struct thread_map *thread_map__realloc(struct thread_map *map, int nr)
{ {
size_t size = sizeof(*map) + sizeof(pid_t) * nr; size_t size = sizeof(*map) + sizeof(map->map[0]) * nr;
return realloc(map, size); return realloc(map, size);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment