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

kmalloc() may fail, if so return -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Kulikov Vasiliy 2010-08-09 17:19:58 -07:00 коммит произвёл Linus Torvalds
Родитель cc8e970c3c
Коммит 51980ac9e7
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -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;