vhost: vhost_scsi_handle_vq() should just use copy_from_user()
[firefly-linux-kernel-4.4.55.git] / mm / vmalloc.c
index 2b0aa5486092dca2745c2ec201cda44db033550c..39c338896416bd9f70d197ec30ddd003d935c65e 100644 (file)
@@ -463,8 +463,7 @@ overflow:
                goto retry;
        }
        if (printk_ratelimit())
-               printk(KERN_WARNING
-                       "vmap allocation for size %lu failed: "
+               pr_warn("vmap allocation for size %lu failed: "
                        "use vmalloc=<size> to increase size.\n", size);
        kfree(va);
        return ERR_PTR(-EBUSY);
@@ -2575,10 +2574,10 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v)
                if (!counters)
                        return;
 
-               /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
-               smp_rmb();
                if (v->flags & VM_UNINITIALIZED)
                        return;
+               /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
+               smp_rmb();
 
                memset(counters, 0, nr_node_ids * sizeof(unsigned int));
 
@@ -2646,21 +2645,11 @@ static const struct seq_operations vmalloc_op = {
 
 static int vmalloc_open(struct inode *inode, struct file *file)
 {
-       unsigned int *ptr = NULL;
-       int ret;
-
-       if (IS_ENABLED(CONFIG_NUMA)) {
-               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;
-               m->private = ptr;
-       } else
-               kfree(ptr);
-       return ret;
+       if (IS_ENABLED(CONFIG_NUMA))
+               return seq_open_private(file, &vmalloc_op,
+                                       nr_node_ids * sizeof(unsigned int));
+       else
+               return seq_open(file, &vmalloc_op);
 }
 
 static const struct file_operations proc_vmalloc_operations = {