staging: lustre: cfs_percpt_alloc: use kvmalloc(GFP_KERNEL)
authorNeilBrown <neilb@suse.com>
Tue, 9 Jan 2018 01:19:38 +0000 (12:19 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 14:41:57 +0000 (15:41 +0100)
this allocation is called from several places, but all are
during initialization, so GFP_NOFS is not needed.
So use kvmalloc and GFP_KERNEL.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/libcfs/libcfs_mem.c

index 23734cfb5d449fdd879724deea5272d15fde4ff3..8e2b4f1db0a1c673d0a1e968b7f1545bbaba65b3 100644 (file)
@@ -54,8 +54,7 @@ cfs_percpt_free(void *vars)
                        LIBCFS_FREE(arr->va_ptrs[i], arr->va_size);
        }
 
-       LIBCFS_FREE(arr, offsetof(struct cfs_var_array,
-                                 va_ptrs[arr->va_count]));
+       kvfree(arr);
 }
 EXPORT_SYMBOL(cfs_percpt_free);
 
@@ -79,7 +78,8 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int size)
 
        count = cfs_cpt_number(cptab);
 
-       LIBCFS_ALLOC(arr, offsetof(struct cfs_var_array, va_ptrs[count]));
+       arr = kvzalloc(offsetof(struct cfs_var_array, va_ptrs[count]),
+                      GFP_KERNEL);
        if (!arr)
                return NULL;