Commit 51980ac9 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by Linus Torvalds

mm/vmalloc.c: check kmalloc() return value

kmalloc() may fail, if so return -ENOMEM.
Signed-off-by: default avatarKulikov Vasiliy <segooon@gmail.com>
Acked-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cc8e970c
...@@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file) ...@@ -2437,8 +2437,11 @@ static int vmalloc_open(struct inode *inode, struct file *file)
unsigned int *ptr = NULL; unsigned int *ptr = NULL;
int ret; int ret;
if (NUMA_BUILD) if (NUMA_BUILD) {
ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL);
if (ptr == NULL)
return -ENOMEM;
}
ret = seq_open(file, &vmalloc_op); ret = seq_open(file, &vmalloc_op);
if (!ret) { if (!ret) {
struct seq_file *m = file->private_data; struct seq_file *m = file->private_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment