[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210506131402.10416-1-tangbin@cmss.chinamobile.com>
Date: Thu, 6 May 2021 21:14:02 +0800
From: Tang Bin <tangbin@...s.chinamobile.com>
To: akpm@...ux-foundation.org, ch0.han@....com
Cc: linux-kernel@...r.kernel.org,
Tang Bin <tangbin@...s.chinamobile.com>,
Zhang Shengju <zhangshengju@...s.chinamobile.com>
Subject: [PATCH] tools/vm/page_owner_sort.c: Fix the potential stack overflow risk
Add judgment to fix the potential stack overflow risk
Signed-off-by: Zhang Shengju <zhangshengju@...s.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@...s.chinamobile.com>
---
tools/vm/page_owner_sort.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index 85eb65ea1..bb7c35b77 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");
--
2.20.1.windows.1
Powered by blists - more mailing lists