aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-05-06 03:34:53 -0400
committerDavid Teigland <teigland@redhat.com>2017-08-07 12:23:09 -0400
commit2f48e06102b2541c0957a223c923dc8036112142 (patch)
tree070131c86198d93b0ea9b747511c5814484d6cf8 /fs/dlm
parent790854becc1921d0cf46180ee55beb4a1787e680 (diff)
dlm: Use kcalloc() in two functions
* Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus reuse the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures by pointer dereferences to make the corresponding size determinations a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r--fs/dlm/member.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 89257699d4e4..92c601a11e38 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -217,8 +217,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
217 } 217 }
218 218
219 array_size = max + need; 219 array_size = max + need;
220 220 array = kcalloc(array_size, sizeof(*array), GFP_NOFS);
221 array = kzalloc(array_size * sizeof(struct dlm_slot), GFP_NOFS);
222 if (!array) 221 if (!array)
223 return -ENOMEM; 222 return -ENOMEM;
224 223
@@ -491,8 +490,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls)
491 return; 490 return;
492 491
493 num = ls->ls_num_nodes; 492 num = ls->ls_num_nodes;
494 493 slots = kcalloc(num, sizeof(*slots), GFP_KERNEL);
495 slots = kzalloc(num * sizeof(struct dlm_slot), GFP_KERNEL);
496 if (!slots) 494 if (!slots)
497 return; 495 return;
498 496