summaryrefslogtreecommitdiff
path: root/tools/vm
diff options
context:
space:
mode:
authorTang Bin <tangbin@cmss.chinamobile.com>2021-06-28 19:35:07 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-06-29 10:53:47 -0700
commit85f29cd6a12d430706c39247e7d0207590f581df (patch)
tree60ecac54eb064bd335f64af071905f6fd9eee612 /tools/vm
parent1a14e3779dd58c16b30e56558146e5cc850ba8b0 (diff)
tools/vm/page_owner_sort.c: check malloc() return
Link: https://lkml.kernel.org/r/20210506131402.10416-1-tangbin@cmss.chinamobile.com Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools/vm')
-rw-r--r--tools/vm/page_owner_sort.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index 85eb65ea16d3..0e75f22c9475 100644
--- a/tools/vm/page_owner_sort.c
+++ b/tools/vm/page_owner_sort.c
@@ -132,6 +132,10 @@ int main(int argc, char **argv)
qsort(list, list_size, sizeof(list[0]), compare_txt);
list2 = malloc(sizeof(*list) * list_size);
+ if (!list2) {
+ printf("Out of memory\n");
+ exit(1);
+ }
printf("culling\n");