Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265100 > unrolled thread

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

Started byGeliang Tang <geliangtang@163.com>
First post2015-11-08 15:30 +0100
Last post2015-11-08 15:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/4] staging: lustre: libcfs: use kmalloc_array instead of kmalloc Geliang Tang <geliangtang@163.com> - 2015-11-08 15:30 +0100

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

FromGeliang Tang <geliangtang@163.com>
Date2015-11-08 15:30 +0100
Subject[PATCH 3/4] staging: lustre: libcfs: use kmalloc_array instead of kmalloc
Message-ID<qsz8J-1gC-7@gated-at.bofh.it>
Use kmalloc_array instead of kmalloc to allocate memory for an array.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web