[PATCH 1/1] FS/DLM: replace count*size kzalloc by kcalloc
From: Fabian Frederick
Date: Mon Jun 23 2014 - 12:51:09 EST
kcalloc manages count*sizeof overflow.
Cc: Christine Caulfield <ccaulfie@xxxxxxxxxx>
Cc: David Teigland <teigland@xxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
fs/dlm/lock.c | 2 +-
fs/dlm/member.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 83f3d55..3653dbe 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1427,7 +1427,7 @@ void dlm_scan_waiters(struct dlm_ls *ls)
if (!num_nodes) {
num_nodes = ls->ls_num_nodes;
- warned = kzalloc(num_nodes * sizeof(int), GFP_KERNEL);
+ warned = kcalloc(num_nodes, sizeof(int), GFP_KERNEL);
}
if (!warned)
continue;
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 9c47f1c..aa57ac3 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -218,7 +218,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
array_size = max + need;
- array = kzalloc(array_size * sizeof(struct dlm_slot), GFP_NOFS);
+ array = kcalloc(array_size, sizeof(struct dlm_slot), GFP_NOFS);
if (!array)
return -ENOMEM;
@@ -493,7 +493,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls)
num = ls->ls_num_nodes;
- slots = kzalloc(num * sizeof(struct dlm_slot), GFP_KERNEL);
+ slots = kcalloc(num, sizeof(struct dlm_slot), GFP_KERNEL);
if (!slots)
return;
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/