Commit 2f48e061 authored by Markus Elfring's avatar Markus Elfring Committed by David Teigland

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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 790854be
...@@ -217,8 +217,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size, ...@@ -217,8 +217,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
} }
array_size = max + need; array_size = max + need;
array = kcalloc(array_size, sizeof(*array), GFP_NOFS);
array = kzalloc(array_size * sizeof(struct dlm_slot), GFP_NOFS);
if (!array) if (!array)
return -ENOMEM; return -ENOMEM;
...@@ -491,8 +490,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls) ...@@ -491,8 +490,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls)
return; return;
num = ls->ls_num_nodes; num = ls->ls_num_nodes;
slots = kcalloc(num, sizeof(*slots), GFP_KERNEL);
slots = kzalloc(num * sizeof(struct dlm_slot), GFP_KERNEL);
if (!slots) if (!slots)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment