mm/vmalloc.c: check kmalloc() return value
[sfrench/cifs-2.6.git] / mm / vmalloc.c
index 8b5e4370540be67f1abcb2cc884a3ce82f46bf1a..918c51335d64165348dc3b54775019f7a78bcaa7 100644 (file)
@@ -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;