[PATCH 3/4] staging: lustre: libcfs: use kmalloc_array instead of kmalloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use kmalloc_array instead of kmalloc to allocate memory for an array.

Signed-off-by: Geliang Tang <geliangtang@xxxxxxx>
---
 drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
index 64a136c..3d3713b 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
@@ -60,9 +60,8 @@ int cfs_tracefile_init_arch(void)
 	/* initialize trace_data */
 	memset(cfs_trace_data, 0, sizeof(cfs_trace_data));
 	for (i = 0; i < CFS_TCD_TYPE_MAX; i++) {
-		cfs_trace_data[i] =
-			kmalloc(sizeof(union cfs_trace_data_union) *
-				num_possible_cpus(), GFP_KERNEL);
+		cfs_trace_data[i] = kmalloc_array(num_possible_cpus(),
+				sizeof(union cfs_trace_data_union), GFP_KERNEL);
 		if (cfs_trace_data[i] == NULL)
 			goto out;
 
-- 
2.5.0


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux