From 51980ac9e72fb5f22c81b7798d65b691125d70ee Mon Sep 17 00:00:00 2001 From: Kulikov Vasiliy Date: Mon, 9 Aug 2010 17:19:58 -0700 Subject: [PATCH] mm/vmalloc.c: check kmalloc() return value kmalloc() may fail, if so return -ENOMEM. Signed-off-by: Kulikov Vasiliy Acked-by: Pekka Enberg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/vmalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 8b5e4370540..918c51335d6 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file) unsigned int *ptr = NULL; int ret; - if (NUMA_BUILD) + if (NUMA_BUILD) { ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); + if (ptr == NULL) + return -ENOMEM; + } ret = seq_open(file, &vmalloc_op); if (!ret) { struct seq_file *m = file->private_data; -- 2.20.1