diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-05-06 09:34:53 +0200 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2017-08-07 18:23:09 +0200 |
commit | 2f48e06102b2541c0957a223c923dc8036112142 (patch) | |
tree | 070131c86198d93b0ea9b747511c5814484d6cf8 /fs/dlm | |
parent | dlm: Use kmalloc_array() in make_member_array() (diff) | |
download | linux-2f48e06102b2541c0957a223c923dc8036112142.tar.xz linux-2f48e06102b2541c0957a223c923dc8036112142.zip |
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.c | 6 |
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, } array_size = max + need; - - array = kzalloc(array_size * sizeof(struct dlm_slot), GFP_NOFS); + array = kcalloc(array_size, sizeof(*array), GFP_NOFS); if (!array) return -ENOMEM; @@ -491,8 +490,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls) return; num = ls->ls_num_nodes; - - slots = kzalloc(num * sizeof(struct dlm_slot), GFP_KERNEL); + slots = kcalloc(num, sizeof(*slots), GFP_KERNEL); if (!slots) return; |