aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/mem2node.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/mem2node.c')
-rw-r--r--tools/perf/util/mem2node.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/util/mem2node.c b/tools/perf/util/mem2node.c
index c6fd81c02586..81c5a2e438b7 100644
--- a/tools/perf/util/mem2node.c
+++ b/tools/perf/util/mem2node.c
@@ -1,5 +1,6 @@
#include <errno.h>
#include <inttypes.h>
+#include <asm/bug.h>
#include <linux/bitmap.h>
#include "mem2node.h"
#include "util.h"
@@ -92,7 +93,7 @@ int mem2node__init(struct mem2node *map, struct perf_env *env)
/* Cut unused entries, due to merging. */
tmp_entries = realloc(entries, sizeof(*entries) * j);
- if (tmp_entries)
+ if (tmp_entries || WARN_ON_ONCE(j == 0))
entries = tmp_entries;
for (i = 0; i < j; i++) {