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 <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Mark Salyzyn <[email protected]>
Cc: Seiji Aguchi <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Tony Luck <[email protected]>
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