[PATCH v3 1/8] pstore: Replace four kzalloc() calls by kcalloc() in ramoops_init_przs()

From: Nobuhiro Iwamatsu
Date: Tue Oct 18 2016 - 03:14:59 EST


The script "checkpatch.pl" can point information out like the following.

WARNING: Prefer kcalloc over kzalloc with multiply

Thus fix the affected source code places.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.kw@xxxxxxxxxxx>
Cc: Anton Vorontsov <anton@xxxxxxxxxx>
Cc: Colin Cross <ccross@xxxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Mark Salyzyn <salyzyn@xxxxxxxxxxx>
Cc: Seiji Aguchi <seiji.aguchi.tr@xxxxxxxxxxx>
Cc: Shuah Khan <shuahkh@xxxxxxxxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>

V3:
New patch.
---
fs/pstore/ram.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 6ad831b..0bef455 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -424,8 +424,8 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
if (!cxt->max_dump_cnt)
return -ENOMEM;

- cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt,
- GFP_KERNEL);
+ cxt->przs = kcalloc(cxt->max_dump_cnt, sizeof(*cxt->przs),
+ GFP_KERNEL);
if (!cxt->przs) {
dev_err(dev, "failed to initialize a prz array for dumps\n");
goto fail_mem;
--
2.9.3