All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/vm/page_owner_sort.c: Fix the potential stack overflow risk
@ 2021-05-06 13:14 Tang Bin
  0 siblings, 0 replies; only message in thread
From: Tang Bin @ 2021-05-06 13:14 UTC (permalink / raw)
  To: akpm, ch0.han; +Cc: linux-kernel, Tang Bin, Zhang Shengju

Add judgment to fix the potential stack overflow risk

Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-06 13:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 13:14 [PATCH] tools/vm/page_owner_sort.c: Fix the potential stack overflow risk Tang Bin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.