diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-12 21:25:00 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-12 21:25:00 +0200 |
commit | 272172bd418cc32aa466588150c8001bc229c712 (patch) | |
tree | f529a66933e79ba1f3753e8185112538e861c967 /tools/perf/util/cpumap.c | |
parent | Merge tag 'perf-core-for-mingo-5.4-20190729' of git://git.kernel.org/pub/scm/... (diff) | |
parent | Linux 5.3-rc4 (diff) | |
download | linux-272172bd418cc32aa466588150c8001bc229c712.tar.xz linux-272172bd418cc32aa466588150c8001bc229c712.zip |
Merge remote-tracking branch 'torvalds/master' into perf/core
To get closer to upstream and check if we need to sync more UAPI
headers, pick up fixes for libbpf that prevent perf's container tests
from completing successfuly, etc.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/cpumap.c')
-rw-r--r-- | tools/perf/util/cpumap.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 71d4d7b35a57..beb3525e9e45 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c @@ -537,7 +537,10 @@ size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size) unsigned char *bitmap; int last_cpu = cpu_map__cpu(map, map->nr - 1); - bitmap = zalloc((last_cpu + 7) / 8); + if (buf == NULL) + return 0; + + bitmap = zalloc(last_cpu / 8 + 1); if (bitmap == NULL) { buf[0] = '\0'; return 0; |